diff options
author | Sage Weil <sage@newdream.net> | 2010-12-09 19:36:28 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2010-12-10 16:29:10 -0500 |
commit | 75eaa0e22c055e38982df267d0f84cc510ba38bf (patch) | |
tree | 073828ec809c95dbae9368b7f83a3734dad82b45 | |
parent | 24ae63656a165c870c0d69fcc8aac1dc35e25e34 (diff) |
Btrfs: fix sync subvol/snapshot creation
We were incorrectly taking the async path even for the sync ioctls by
passing in &transid unconditionally.
There's ample room for further cleanup here, but this keeps the fix simple.
Signed-off-by: Sage Weil <sage@newdream.net>
Reviewed-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
-rw-r--r-- | fs/btrfs/ioctl.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index f1c9bb4079ed..7cc2e8e075b4 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -964,6 +964,15 @@ static noinline int btrfs_ioctl_snap_create(struct file *file, | |||
964 | name = async_vol_args->name; | 964 | name = async_vol_args->name; |
965 | fd = async_vol_args->fd; | 965 | fd = async_vol_args->fd; |
966 | async_vol_args->name[BTRFS_SNAPSHOT_NAME_MAX] = '\0'; | 966 | async_vol_args->name[BTRFS_SNAPSHOT_NAME_MAX] = '\0'; |
967 | |||
968 | ret = btrfs_ioctl_snap_create_transid(file, name, fd, | ||
969 | subvol, &transid); | ||
970 | |||
971 | if (ret == 0 && | ||
972 | copy_to_user(arg + | ||
973 | offsetof(struct btrfs_ioctl_async_vol_args, | ||
974 | transid), &transid, sizeof(transid))) | ||
975 | ret = -EFAULT; | ||
967 | } else { | 976 | } else { |
968 | vol_args = memdup_user(arg, sizeof(*vol_args)); | 977 | vol_args = memdup_user(arg, sizeof(*vol_args)); |
969 | if (IS_ERR(vol_args)) | 978 | if (IS_ERR(vol_args)) |
@@ -971,16 +980,9 @@ static noinline int btrfs_ioctl_snap_create(struct file *file, | |||
971 | name = vol_args->name; | 980 | name = vol_args->name; |
972 | fd = vol_args->fd; | 981 | fd = vol_args->fd; |
973 | vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; | 982 | vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; |
974 | } | ||
975 | 983 | ||
976 | ret = btrfs_ioctl_snap_create_transid(file, name, fd, | 984 | ret = btrfs_ioctl_snap_create_transid(file, name, fd, |
977 | subvol, &transid); | 985 | subvol, NULL); |
978 | |||
979 | if (!ret && async) { | ||
980 | if (copy_to_user(arg + | ||
981 | offsetof(struct btrfs_ioctl_async_vol_args, | ||
982 | transid), &transid, sizeof(transid))) | ||
983 | return -EFAULT; | ||
984 | } | 986 | } |
985 | 987 | ||
986 | kfree(vol_args); | 988 | kfree(vol_args); |