Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 15 May 2009 02:18:44 +0000 (19:18 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 15 May 2009 02:18:44 +0000 (19:18 -0700)
* git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
  Btrfs: Spelling fix in btrfs_lookup_first_block_group comments
  Btrfs: make show_options result match actual option names
  Btrfs: remove outdated comment in btrfs_ioctl_resize()
  Btrfs: remove some WARN_ONs in the IO failure path
  Btrfs: Don't loop forever on metadata IO failures
  Btrfs: init inode ordered_data_close flag properly

1  2 
fs/btrfs/ioctl.c
fs/btrfs/super.c

diff --combined fs/btrfs/ioctl.c
index 5e94ea6e1cbe05ea164e5f6128b87c84b7bc8570,db84aa48ab7aceade2adadb0137d8888b8757c4d..2624b53ea7830d54c89ea92145c7e9382775755a
@@@ -437,10 -437,6 +437,6 @@@ out_unlock
        return 0;
  }
  
- /*
-  * Called inside transaction, so use GFP_NOFS
-  */
  static int btrfs_ioctl_resize(struct btrfs_root *root, void __user *arg)
  {
        u64 new_size;
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
  
 -      vol_args = kmalloc(sizeof(*vol_args), GFP_NOFS);
 -
 -      if (!vol_args)
 -              return -ENOMEM;
 -
 -      if (copy_from_user(vol_args, arg, sizeof(*vol_args))) {
 -              ret = -EFAULT;
 -              goto out;
 -      }
 +      vol_args = memdup_user(arg, sizeof(*vol_args));
 +      if (IS_ERR(vol_args))
 +              return PTR_ERR(vol_args);
  
        vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
        namelen = strlen(vol_args->name);
  
  out_unlock:
        mutex_unlock(&root->fs_info->volume_mutex);
 -out:
        kfree(vol_args);
        return ret;
  }
@@@ -560,9 -563,15 +556,9 @@@ static noinline int btrfs_ioctl_snap_cr
        if (root->fs_info->sb->s_flags & MS_RDONLY)
                return -EROFS;
  
 -      vol_args = kmalloc(sizeof(*vol_args), GFP_NOFS);
 -
 -      if (!vol_args)
 -              return -ENOMEM;
 -
 -      if (copy_from_user(vol_args, arg, sizeof(*vol_args))) {
 -              ret = -EFAULT;
 -              goto out;
 -      }
 +      vol_args = memdup_user(arg, sizeof(*vol_args));
 +      if (IS_ERR(vol_args))
 +              return PTR_ERR(vol_args);
  
        vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
        namelen = strlen(vol_args->name);
@@@ -664,13 -673,19 +660,13 @@@ static long btrfs_ioctl_add_dev(struct 
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
  
 -      vol_args = kmalloc(sizeof(*vol_args), GFP_NOFS);
 +      vol_args = memdup_user(arg, sizeof(*vol_args));
 +      if (IS_ERR(vol_args))
 +              return PTR_ERR(vol_args);
  
 -      if (!vol_args)
 -              return -ENOMEM;
 -
 -      if (copy_from_user(vol_args, arg, sizeof(*vol_args))) {
 -              ret = -EFAULT;
 -              goto out;
 -      }
        vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
        ret = btrfs_init_new_device(root, vol_args->name);
  
 -out:
        kfree(vol_args);
        return ret;
  }
@@@ -686,13 -701,19 +682,13 @@@ static long btrfs_ioctl_rm_dev(struct b
        if (root->fs_info->sb->s_flags & MS_RDONLY)
                return -EROFS;
  
 -      vol_args = kmalloc(sizeof(*vol_args), GFP_NOFS);
 +      vol_args = memdup_user(arg, sizeof(*vol_args));
 +      if (IS_ERR(vol_args))
 +              return PTR_ERR(vol_args);
  
 -      if (!vol_args)
 -              return -ENOMEM;
 -
 -      if (copy_from_user(vol_args, arg, sizeof(*vol_args))) {
 -              ret = -EFAULT;
 -              goto out;
 -      }
        vol_args->name[BTRFS_PATH_NAME_MAX] = '\0';
        ret = btrfs_rm_device(root, vol_args->name);
  
 -out:
        kfree(vol_args);
        return ret;
  }
diff --combined fs/btrfs/super.c
index 6dfae5b28f5939e4dad06410d5c8948eb3574b27,e99510bfbffd4309edb496fe147f9aba889a2ddc..2ff7cd2db25f4cd0ad85470d1da3c3c676b2646e
@@@ -436,9 -436,9 +436,9 @@@ static int btrfs_show_options(struct se
        if (btrfs_test_opt(root, SSD))
                seq_puts(seq, ",ssd");
        if (btrfs_test_opt(root, NOTREELOG))
-               seq_puts(seq, ",no-treelog");
+               seq_puts(seq, ",notreelog");
        if (btrfs_test_opt(root, FLUSHONCOMMIT))
-               seq_puts(seq, ",flush-on-commit");
+               seq_puts(seq, ",flushoncommit");
        if (!(root->fs_info->sb->s_flags & MS_POSIXACL))
                seq_puts(seq, ",noacl");
        return 0;
@@@ -502,7 -502,8 +502,7 @@@ static int btrfs_get_sb(struct file_sys
  
        if (s->s_root) {
                if ((flags ^ s->s_flags) & MS_RDONLY) {
 -                      up_write(&s->s_umount);
 -                      deactivate_super(s);
 +                      deactivate_locked_super(s);
                        error = -EBUSY;
                        goto error_close_devices;
                }
                error = btrfs_fill_super(s, fs_devices, data,
                                         flags & MS_SILENT ? 1 : 0);
                if (error) {
 -                      up_write(&s->s_umount);
 -                      deactivate_super(s);
 +                      deactivate_locked_super(s);
                        goto error_free_subvol_name;
                }
  
                mutex_unlock(&s->s_root->d_inode->i_mutex);
  
                if (IS_ERR(root)) {
 -                      up_write(&s->s_umount);
 -                      deactivate_super(s);
 +                      deactivate_locked_super(s);
                        error = PTR_ERR(root);
                        goto error_free_subvol_name;
                }
                if (!root->d_inode) {
                        dput(root);
 -                      up_write(&s->s_umount);
 -                      deactivate_super(s);
 +                      deactivate_locked_super(s);
                        error = -ENXIO;
                        goto error_free_subvol_name;
                }
@@@ -644,9 -648,14 +644,9 @@@ static long btrfs_control_ioctl(struct 
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
  
 -      vol = kmalloc(sizeof(*vol), GFP_KERNEL);
 -      if (!vol)
 -              return -ENOMEM;
 -
 -      if (copy_from_user(vol, (void __user *)arg, sizeof(*vol))) {
 -              ret = -EFAULT;
 -              goto out;
 -      }
 +      vol = memdup_user((void __user *)arg, sizeof(*vol));
 +      if (IS_ERR(vol))
 +              return PTR_ERR(vol);
  
        switch (cmd) {
        case BTRFS_IOC_SCAN_DEV:
                                            &btrfs_fs_type, &fs_devices);
                break;
        }
 -out:
 +
        kfree(vol);
        return ret;
  }