]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
switch btrfs_ioctl_snap_create_transid() to fget_light()
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 27 Aug 2012 01:20:24 +0000 (21:20 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 6 Sep 2012 13:49:09 +0000 (09:49 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/btrfs/ioctl.c

index 7bb755677a220f71fd0540932c0c19565aec6a23..080a97a77905bc913ee9c9d4ff0d1715ed040cc3 100644 (file)
@@ -1422,7 +1422,8 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
                                     NULL, transid, readonly, inherit);
        } else {
                struct inode *src_inode;
-               src_file = fget(fd);
+               int fput_needed;
+               src_file = fget_light(fd, &fput_needed);
                if (!src_file) {
                        ret = -EINVAL;
                        goto out_drop_write;
@@ -1433,13 +1434,12 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
                        printk(KERN_INFO "btrfs: Snapshot src from "
                               "another FS\n");
                        ret = -EINVAL;
-                       fput(src_file);
-                       goto out_drop_write;
+               } else {
+                       ret = btrfs_mksubvol(&file->f_path, name, namelen,
+                                            BTRFS_I(src_inode)->root,
+                                            transid, readonly, inherit);
                }
-               ret = btrfs_mksubvol(&file->f_path, name, namelen,
-                                    BTRFS_I(src_inode)->root,
-                                    transid, readonly, inherit);
-               fput(src_file);
+               fput_light(src_file, fput_needed);
        }
 out_drop_write:
        mnt_drop_write_file(file);