summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2011-11-10 20:45:05 -0500
committerChris Mason <chris.mason@oracle.com>2011-11-10 20:45:05 -0500
commit62f30c5462374b991e7e3f42d49ce2265c1b82f1 (patch)
tree4d991bd451bcc9e619bb4b775b4acc6a0e3fca8f
parent2f120c05e67ae34c93786b1050c6828904314429 (diff)
downloadlinux-stable-62f30c5462374b991e7e3f42d49ce2265c1b82f1.tar.gz
linux-stable-62f30c5462374b991e7e3f42d49ce2265c1b82f1.tar.bz2
linux-stable-62f30c5462374b991e7e3f42d49ce2265c1b82f1.zip
Btrfs: fix deadlock caused by the race between relocation
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>
-rw-r--r--fs/btrfs/transaction.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 960835eaf4da..6a0574e923bc 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -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;