diff options
author | Chris Mason <chris.mason@oracle.com> | 2011-06-17 14:16:13 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-06-17 14:16:13 -0400 |
commit | e038dca803423bb7a3fa9a162b7dcc225efe9bf9 (patch) | |
tree | efd5d76b77f21b4a9e570f2cb5bed9f95970f7a0 /fs/btrfs/transaction.c | |
parent | 7585717f304f5ed005cc4ad933a69aab3efbd136 (diff) | |
parent | ed0ca14021e5ae3147602128641aa7f742ab227c (diff) | |
download | blackbird-op-linux-e038dca803423bb7a3fa9a162b7dcc225efe9bf9.tar.gz blackbird-op-linux-e038dca803423bb7a3fa9a162b7dcc225efe9bf9.zip |
Merge branch 'for-chris' of git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-work into for-linus
Conflicts:
fs/btrfs/transaction.c
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r-- | fs/btrfs/transaction.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 833996a0c628..c073d85e14f3 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -1298,13 +1298,21 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, schedule_timeout(1); finish_wait(&cur_trans->writer_wait, &wait); - spin_lock(&root->fs_info->trans_lock); - root->fs_info->trans_no_join = 1; - spin_unlock(&root->fs_info->trans_lock); } 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 |