Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
[deliverable/linux.git] / fs / btrfs / ioctl.c
index 43f0012016e3e6291cb79579a60940f52ec94a9c..7bb755677a220f71fd0540932c0c19565aec6a23 100644 (file)
@@ -195,6 +195,10 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
        if (!inode_owner_or_capable(inode))
                return -EACCES;
 
+       ret = mnt_want_write_file(file);
+       if (ret)
+               return ret;
+
        mutex_lock(&inode->i_mutex);
 
        ip_oldflags = ip->flags;
@@ -209,10 +213,6 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
                }
        }
 
-       ret = mnt_want_write_file(file);
-       if (ret)
-               goto out_unlock;
-
        if (flags & FS_SYNC_FL)
                ip->flags |= BTRFS_INODE_SYNC;
        else
@@ -275,9 +275,9 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
                inode->i_flags = i_oldflags;
        }
 
-       mnt_drop_write_file(file);
  out_unlock:
        mutex_unlock(&inode->i_mutex);
+       mnt_drop_write_file(file);
        return ret;
 }
 
This page took 0.074435 seconds and 5 git commands to generate.