diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index b44adb40635d..7f8e04c11494 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -1198,17 +1198,9 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc) if (!sdp->sd_delete_wq) goto fail_glock_wq; - char *bufdata_name = kasprintf(GFP_KERNEL, "gfs2-bufdata/%s", sdp->sd_fsname); - sdp->sd_bufdata = kmem_cache_create(bufdata_name, - sizeof(struct gfs2_bufdata), - 0, 0, NULL); - kfree(bufdata_name); - if (!sdp->sd_bufdata) - goto fail_delete_wq; - error = gfs2_sys_fs_add(sdp); if (error) - goto fail_bufdata; + goto fail_delete_wq; gfs2_create_debugfs_file(sdp); @@ -1255,6 +1247,14 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc) snprintf(sdp->sd_fsname, sizeof(sdp->sd_fsname), "%s.%u", sdp->sd_table_name, sdp->sd_lockstruct.ls_jid); + char *bufdata_name = kasprintf(GFP_KERNEL, "gfs2-bufdata/%s", sdp->sd_fsname); + sdp->sd_bufdata = kmem_cache_create(bufdata_name, + sizeof(struct gfs2_bufdata), + 0, 0, NULL); + kfree(bufdata_name); + if (!sdp->sd_bufdata) + goto fail_sb; + error = init_inodes(sdp, DO); if (error) goto fail_sb; @@ -1304,6 +1304,7 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc) if (sb->s_root) dput(sb->s_root); sb->s_root = NULL; + kmem_cache_destroy(sdp->sd_bufdata); fail_locking: init_locking(sdp, &mount_gh, UNDO); fail_lm: @@ -1313,8 +1314,6 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc) fail_debug: gfs2_delete_debugfs_file(sdp); gfs2_sys_fs_del(sdp); -fail_bufdata: - kmem_cache_destroy(sdp->sd_bufdata); fail_delete_wq: destroy_workqueue(sdp->sd_delete_wq); fail_glock_wq: