Skip to contentSkip to conversation

Btrfs: fix deadlock caused by the race between relocation and snapshot creation

PATCH In review Miao Xie 1 participant 1 message Nov 10, 2011 Btrfs file system

lore
Share & tools
lore

Miao Xie

author
#0 lore raw

PATCH 5/6 Btrfs: fix deadlock caused by the race between relocation and snapshot creation

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.

---
 fs/btrfs/transaction.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/transaction.c +2 -2
index e3d2970..00d5510 100644
@@ -881,8 +881,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;
Signature · 1 line
1.7.6.4