diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2013-03-04 04:45:06 -0500 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-03-04 16:33:22 -0500 |
commit | 00d71c9c17b1fd28fa54f323a29a0e23c6d3de40 (patch) | |
tree | fb0ffcef82cf903fac454a19745df21485c8d5b6 /fs | |
parent | aec8030a8745221c8658f2033b22c98528897b13 (diff) |
Btrfs: fix unclosed transaction handler when the async transaction commitment fails
If the async transaction commitment failed, we need close the
current transaction handler, or the current transaction will be
blocked to commit because of this orphan handler.
We fix the problem by doing sync transaction commitment, that is
to invoke btrfs_commit_transaction().
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/ioctl.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 94c0e42dfa1e..3fdfabcc1aaa 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,6 +594,8 @@ 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); |