summaryrefslogtreecommitdiff
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2015-02-04 19:43:01 +0300
committerRob Herring <robh@kernel.org>2015-02-04 19:43:01 +0300
commit962a70d05edac2e2eb53cd077715930083964b9e (patch)
treef0b3a7bd574b2edfa76ce960e7f8630aea77e257 /fs/btrfs/super.c
parent10638a4ed2b8618f20fabf9ed19df60a68446e90 (diff)
parent26bc420b59a38e4e6685a73345a0def461136dce (diff)
downloadlinux-962a70d05edac2e2eb53cd077715930083964b9e.tar.xz
Merge tag 'v3.19-rc6' into HEAD
Linux 3.19-rc6
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r--fs/btrfs/super.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 60f7cbe815e9..6f49b2872a64 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1000,10 +1000,20 @@ int btrfs_sync_fs(struct super_block *sb, int wait)
*/
if (fs_info->pending_changes == 0)
return 0;
+ /*
+ * A non-blocking test if the fs is frozen. We must not
+ * start a new transaction here otherwise a deadlock
+ * happens. The pending operations are delayed to the
+ * next commit after thawing.
+ */
+ if (__sb_start_write(sb, SB_FREEZE_WRITE, false))
+ __sb_end_write(sb, SB_FREEZE_WRITE);
+ else
+ return 0;
trans = btrfs_start_transaction(root, 0);
- } else {
- return PTR_ERR(trans);
}
+ if (IS_ERR(trans))
+ return PTR_ERR(trans);
}
return btrfs_commit_transaction(trans, root);
}