From 098c252ed0fd1ae6330a9195be8aeed4ca414d28 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Fri, 24 Aug 2012 12:53:03 -0600 Subject: [PATCH] --- yaml --- r: 322371 b: refs/heads/master c: bd7de2c9a449e26a5493d918618eb20ae60d56bd h: refs/heads/master i: 322369: c614044f4fff09934838e8f2b49421acb32a0499 322367: de206214a63f7b3d47376407aaf115a656c8b22f v: v3 --- [refs] | 2 +- trunk/fs/btrfs/super.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 380435d10c0f..c4599f5fd288 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5ee0844d6427e7338e0aba748f62b62d07ea2ed0 +refs/heads/master: bd7de2c9a449e26a5493d918618eb20ae60d56bd diff --git a/trunk/fs/btrfs/super.c b/trunk/fs/btrfs/super.c index 2e06f124f284..073c2368f459 100644 --- a/trunk/fs/btrfs/super.c +++ b/trunk/fs/btrfs/super.c @@ -813,7 +813,6 @@ int btrfs_sync_fs(struct super_block *sb, int wait) struct btrfs_trans_handle *trans; struct btrfs_fs_info *fs_info = btrfs_sb(sb); struct btrfs_root *root = fs_info->tree_root; - int ret; trace_btrfs_sync_fs(wait); @@ -824,11 +823,17 @@ int btrfs_sync_fs(struct super_block *sb, int wait) btrfs_wait_ordered_extents(root, 0, 0); - trans = btrfs_start_transaction(root, 0); + spin_lock(&fs_info->trans_lock); + if (!fs_info->running_transaction) { + spin_unlock(&fs_info->trans_lock); + return 0; + } + spin_unlock(&fs_info->trans_lock); + + trans = btrfs_join_transaction(root); if (IS_ERR(trans)) return PTR_ERR(trans); - ret = btrfs_commit_transaction(trans, root); - return ret; + return btrfs_commit_transaction(trans, root); } static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)