Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 318845
b: refs/heads/master
c: a874a63
h: refs/heads/master
i:
  318843: bc97c74
v: v3
  • Loading branch information
Liu Bo authored and Chris Mason committed Jul 23, 2012
1 parent b494b94 commit d2399d7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 287082b0bd10060e9c6b32ed9605174ddf2f672a
refs/heads/master: a874a63e1389c1daabd5abe4e4faaf9d63daf474
22 changes: 11 additions & 11 deletions trunk/fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,13 +652,9 @@ static noinline int btrfs_mksubvol(struct path *parent,
if (dentry->d_inode)
goto out_dput;

error = mnt_want_write(parent->mnt);
if (error)
goto out_dput;

error = btrfs_may_create(dir, dentry);
if (error)
goto out_drop_write;
goto out_dput;

down_read(&BTRFS_I(dir)->root->fs_info->subvol_sem);

Expand All @@ -676,8 +672,6 @@ static noinline int btrfs_mksubvol(struct path *parent,
fsnotify_mkdir(dir, dentry);
out_up_read:
up_read(&BTRFS_I(dir)->root->fs_info->subvol_sem);
out_drop_write:
mnt_drop_write(parent->mnt);
out_dput:
dput(dentry);
out_unlock:
Expand Down Expand Up @@ -1395,16 +1389,20 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
if (root->fs_info->sb->s_flags & MS_RDONLY)
return -EROFS;

ret = mnt_want_write_file(file);
if (ret)
goto out;

namelen = strlen(name);
if (strchr(name, '/')) {
ret = -EINVAL;
goto out;
goto out_drop_write;
}

if (name[0] == '.' &&
(namelen == 1 || (name[1] == '.' && namelen == 2))) {
ret = -EEXIST;
goto out;
goto out_drop_write;
}

if (subvol) {
Expand All @@ -1415,7 +1413,7 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
src_file = fget(fd);
if (!src_file) {
ret = -EINVAL;
goto out;
goto out_drop_write;
}

src_inode = src_file->f_path.dentry->d_inode;
Expand All @@ -1424,13 +1422,15 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file,
"another FS\n");
ret = -EINVAL;
fput(src_file);
goto out;
goto out_drop_write;
}
ret = btrfs_mksubvol(&file->f_path, name, namelen,
BTRFS_I(src_inode)->root,
transid, readonly);
fput(src_file);
}
out_drop_write:
mnt_drop_write_file(file);
out:
return ret;
}
Expand Down

0 comments on commit d2399d7

Please sign in to comment.