From: Chris Mason Date: Fri, 17 Jun 2011 18:16:13 +0000 (-0400) Subject: Merge branch 'for-chris' of git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs... X-Git-Tag: upstream/snapshot3+hdmi~9699^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e038dca803423bb7a3fa9a162b7dcc225efe9bf9;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git Merge branch 'for-chris' of git://git./linux/kernel/git/josef/btrfs-work into for-linus Conflicts: fs/btrfs/transaction.c Signed-off-by: Chris Mason --- e038dca803423bb7a3fa9a162b7dcc225efe9bf9 diff --cc fs/btrfs/transaction.c index 833996a,5669559..c073d85 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@@ -1305,12 -1245,16 +1302,23 @@@ int btrfs_commit_transaction(struct btr (should_grow && cur_trans->num_joined != joined)); /* + * Ok now we need to make sure to block out any other joins while we + * commit the transaction. We could have started a join before setting + * no_join so make sure to wait for num_writers to == 1 again. + */ + spin_lock(&root->fs_info->trans_lock); + root->fs_info->trans_no_join = 1; + spin_unlock(&root->fs_info->trans_lock); + wait_event(cur_trans->writer_wait, + atomic_read(&cur_trans->num_writers) == 1); + ++ /* + * the reloc mutex makes sure that we stop + * the balancing code from coming in and moving + * extents around in the middle of the commit + */ + mutex_lock(&root->fs_info->reloc_mutex); + ret = create_pending_snapshots(trans, root->fs_info); BUG_ON(ret);