aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-11-17 01:56:28 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-08 19:34:41 -0500
commit59553edf110e5576d91be9dd5bd53d110e0d0290 (patch)
tree80db6c318f2cd766422ce1024dbb044364ede957
parentd22ca7de770e2a683eac000ba4db5a95e2f4c969 (diff)
btrfs: consolidate failure exits in btrfs_mount() a bit
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/btrfs/super.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index f628a6a79ca6..15c8ae571e40 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -630,6 +630,7 @@ static int btrfs_fill_super(struct super_block *sb,
630 630
631 save_mount_options(sb, data); 631 save_mount_options(sb, data);
632 cleancache_init_fs(sb); 632 cleancache_init_fs(sb);
633 sb->s_flags |= MS_ACTIVE;
633 return 0; 634 return 0;
634 635
635fail_close: 636fail_close:
@@ -929,14 +930,10 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags,
929 } 930 }
930 931
931 if (s->s_root) { 932 if (s->s_root) {
932 if ((flags ^ s->s_flags) & MS_RDONLY) {
933 deactivate_locked_super(s);
934 error = -EBUSY;
935 goto error_close_devices;
936 }
937
938 btrfs_close_devices(fs_devices); 933 btrfs_close_devices(fs_devices);
939 free_fs_info(fs_info); 934 free_fs_info(fs_info);
935 if ((flags ^ s->s_flags) & MS_RDONLY)
936 error = -EBUSY;
940 } else { 937 } else {
941 char b[BDEVNAME_SIZE]; 938 char b[BDEVNAME_SIZE];
942 939
@@ -945,19 +942,11 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags,
945 btrfs_sb(s)->fs_info->bdev_holder = fs_type; 942 btrfs_sb(s)->fs_info->bdev_holder = fs_type;
946 error = btrfs_fill_super(s, fs_devices, data, 943 error = btrfs_fill_super(s, fs_devices, data,
947 flags & MS_SILENT ? 1 : 0); 944 flags & MS_SILENT ? 1 : 0);
948 if (error) {
949 deactivate_locked_super(s);
950 return ERR_PTR(error);
951 }
952
953 s->s_flags |= MS_ACTIVE;
954 } 945 }
955 946
956 root = get_default_root(s, subvol_objectid); 947 root = !error ? get_default_root(s, subvol_objectid) : ERR_PTR(error);
957 if (IS_ERR(root)) { 948 if (IS_ERR(root))
958 deactivate_locked_super(s); 949 deactivate_locked_super(s);
959 return root;
960 }
961 950
962 return root; 951 return root;
963 952