diff options
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r-- | fs/btrfs/ioctl.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index b908960c9746..898c5729e7e5 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -527,6 +527,8 @@ fail: | |||
527 | if (async_transid) { | 527 | if (async_transid) { |
528 | *async_transid = trans->transid; | 528 | *async_transid = trans->transid; |
529 | err = btrfs_commit_transaction_async(trans, root, 1); | 529 | err = btrfs_commit_transaction_async(trans, root, 1); |
530 | if (err) | ||
531 | err = btrfs_commit_transaction(trans, root); | ||
530 | } else { | 532 | } else { |
531 | err = btrfs_commit_transaction(trans, root); | 533 | err = btrfs_commit_transaction(trans, root); |
532 | } | 534 | } |
@@ -592,16 +594,14 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir, | |||
592 | *async_transid = trans->transid; | 594 | *async_transid = trans->transid; |
593 | ret = btrfs_commit_transaction_async(trans, | 595 | ret = btrfs_commit_transaction_async(trans, |
594 | root->fs_info->extent_root, 1); | 596 | root->fs_info->extent_root, 1); |
597 | if (ret) | ||
598 | ret = btrfs_commit_transaction(trans, root); | ||
595 | } else { | 599 | } else { |
596 | ret = btrfs_commit_transaction(trans, | 600 | ret = btrfs_commit_transaction(trans, |
597 | root->fs_info->extent_root); | 601 | root->fs_info->extent_root); |
598 | } | 602 | } |
599 | if (ret) { | 603 | if (ret) |
600 | /* cleanup_transaction has freed this for us */ | ||
601 | if (trans->aborted) | ||
602 | pending_snapshot = NULL; | ||
603 | goto fail; | 604 | goto fail; |
604 | } | ||
605 | 605 | ||
606 | ret = pending_snapshot->error; | 606 | ret = pending_snapshot->error; |
607 | if (ret) | 607 | if (ret) |
@@ -2245,13 +2245,6 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp) | |||
2245 | if (ret) | 2245 | if (ret) |
2246 | return ret; | 2246 | return ret; |
2247 | 2247 | ||
2248 | if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running, | ||
2249 | 1)) { | ||
2250 | pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n"); | ||
2251 | mnt_drop_write_file(file); | ||
2252 | return -EINVAL; | ||
2253 | } | ||
2254 | |||
2255 | if (btrfs_root_readonly(root)) { | 2248 | if (btrfs_root_readonly(root)) { |
2256 | ret = -EROFS; | 2249 | ret = -EROFS; |
2257 | goto out; | 2250 | goto out; |
@@ -2306,7 +2299,6 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp) | |||
2306 | ret = -EINVAL; | 2299 | ret = -EINVAL; |
2307 | } | 2300 | } |
2308 | out: | 2301 | out: |
2309 | atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0); | ||
2310 | mnt_drop_write_file(file); | 2302 | mnt_drop_write_file(file); |
2311 | return ret; | 2303 | return ret; |
2312 | } | 2304 | } |