Skip to content

Commit

Permalink
Btrfs: avoid deadlock on transaction waiting list
Browse files Browse the repository at this point in the history
Only let one trans handle to wait for other handles, otherwise we
will get ABBA issues.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
  • Loading branch information
Liu Bo authored and Josef Bacik committed Mar 4, 2013
1 parent 0f788c5 commit 66b6135
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fs/btrfs/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,13 @@ static void cleanup_transaction(struct btrfs_trans_handle *trans,
btrfs_abort_transaction(trans, root, err);

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);
if (cur_trans == root->fs_info->running_transaction) {
root->fs_info->trans_no_join = 1;
Expand Down

0 comments on commit 66b6135

Please sign in to comment.