Skip to content

Commit

Permalink
Btrfs: fix deadlock caused by the race between relocation
Browse files Browse the repository at this point in the history
We can not do flushable reservation for the relocation when we create snapshot,
because it may make the transaction commit task and the flush task wait for
each other and the deadlock happens.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Miao Xie authored and Chris Mason committed Nov 11, 2011
1 parent 2f120c0 commit 62f30c5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/btrfs/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,8 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
btrfs_reloc_pre_snapshot(trans, pending, &to_reserve);

if (to_reserve > 0) {
ret = btrfs_block_rsv_add(root, &pending->block_rsv,
to_reserve);
ret = btrfs_block_rsv_add_noflush(root, &pending->block_rsv,
to_reserve);
if (ret) {
pending->error = ret;
goto fail;
Expand Down

0 comments on commit 62f30c5

Please sign in to comment.