summaryrefslogtreecommitdiff
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2015-01-26 11:02:59 +0100
committerThomas Gleixner <tglx@linutronix.de>2015-01-26 11:02:59 +0100
commit64c96a57b73397415eafa4ac2020ea7d99d7168c (patch)
treee71719d174d22aab6362858d383c292149ec8ae9 /fs/btrfs/super.c
parente2e64a932556cdfae455497dbe94a8db151fc9fa (diff)
parent26bc420b59a38e4e6685a73345a0def461136dce (diff)
Merge branch 'linus' into irq/core
Reason: Pull in upstream fixes on which new patches depend on.
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);
}