btrfs: On error always free subvol_name in btrfs_mount
[sfrench/cifs-2.6.git] / fs / btrfs / super.c
index 645fc81e2a948eab03431a08c0c4b062ce7fd25e..74023786a73510ab5d38a6e90185b82e6511dc8b 100644 (file)
@@ -93,7 +93,7 @@ const char *btrfs_decode_error(int errno)
 
 /*
  * __btrfs_handle_fs_error decodes expected errors from the caller and
- * invokes the approciate error response.
+ * invokes the appropriate error response.
  */
 __cold
 void __btrfs_handle_fs_error(struct btrfs_fs_info *fs_info, const char *function,
@@ -151,7 +151,7 @@ void __btrfs_handle_fs_error(struct btrfs_fs_info *fs_info, const char *function
         * although there is no way to update the progress. It would add the
         * risk of a deadlock, therefore the canceling is omitted. The only
         * penalty is that some I/O remains active until the procedure
-        * completes. The next time when the filesystem is mounted writeable
+        * completes. The next time when the filesystem is mounted writable
         * again, the device replace operation continues.
         */
 }
@@ -1677,6 +1677,7 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags,
                                flags | SB_RDONLY, device_name, data);
                        if (IS_ERR(mnt_root)) {
                                root = ERR_CAST(mnt_root);
+                               kfree(subvol_name);
                                goto out;
                        }
 
@@ -1686,12 +1687,14 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags,
                        if (error < 0) {
                                root = ERR_PTR(error);
                                mntput(mnt_root);
+                               kfree(subvol_name);
                                goto out;
                        }
                }
        }
        if (IS_ERR(mnt_root)) {
                root = ERR_CAST(mnt_root);
+               kfree(subvol_name);
                goto out;
        }
 
@@ -1848,7 +1851,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
 
                if (!btrfs_check_rw_degradable(fs_info, NULL)) {
                        btrfs_warn(fs_info,
-                               "too many missing devices, writeable remount is not allowed");
+               "too many missing devices, writable remount is not allowed");
                        ret = -EACCES;
                        goto restore;
                }
@@ -2090,7 +2093,7 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf)
        u64 total_free_data = 0;
        u64 total_free_meta = 0;
        int bits = dentry->d_sb->s_blocksize_bits;
-       __be32 *fsid = (__be32 *)fs_info->fsid;
+       __be32 *fsid = (__be32 *)fs_info->fs_devices->fsid;
        unsigned factor = 1;
        struct btrfs_block_rsv *block_rsv = &fs_info->global_block_rsv;
        int ret;
@@ -2312,7 +2315,7 @@ static int btrfs_show_devname(struct seq_file *m, struct dentry *root)
         * device_list_mutex here as we only read the device data and the list
         * is protected by RCU.  Even if a device is deleted during the list
         * traversals, we'll get valid data, the freeing callback will wait at
-        * least until until the rcu_read_unlock.
+        * least until the rcu_read_unlock.
         */
        rcu_read_lock();
        cur_devices = fs_info->fs_devices;