Commit 66b6135b authored by Liu Bo's avatar Liu Bo Committed by Josef Bacik

Btrfs: avoid deadlock on transaction waiting list

Only let one trans handle to wait for other handles, otherwise we
will get ABBA issues.
Signed-off-by: default avatarLiu Bo <bo.li.liu@oracle.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
parent 0f788c58
...@@ -1457,6 +1457,13 @@ static void cleanup_transaction(struct btrfs_trans_handle *trans, ...@@ -1457,6 +1457,13 @@ static void cleanup_transaction(struct btrfs_trans_handle *trans,
btrfs_abort_transaction(trans, root, err); btrfs_abort_transaction(trans, root, err);
spin_lock(&root->fs_info->trans_lock); spin_lock(&root->fs_info->trans_lock);
if (list_empty(&cur_trans->list)) {
spin_unlock(&root->fs_info->trans_lock);
btrfs_end_transaction(trans, root);
return;
}
list_del_init(&cur_trans->list); list_del_init(&cur_trans->list);
if (cur_trans == root->fs_info->running_transaction) { if (cur_trans == root->fs_info->running_transaction) {
root->fs_info->trans_no_join = 1; root->fs_info->trans_no_join = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment