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: v3.0-rc4~9^2~5 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=e038dca803423bb7a3fa9a162b7dcc225efe9bf9;p=linux-block.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 833996a0c628,56695595e036..c073d85e14f3 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@@ -1301,16 -1244,17 +1301,24 @@@ int btrfs_commit_transaction(struct btr } while (atomic_read(&cur_trans->num_writers) > 1 || (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);