Merge branch 'for-chris' of git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs...
authorChris Mason <chris.mason@oracle.com>
Fri, 17 Jun 2011 18:16:13 +0000 (14:16 -0400)
committerChris Mason <chris.mason@oracle.com>
Fri, 17 Jun 2011 18:16:13 +0000 (14:16 -0400)
Conflicts:
fs/btrfs/transaction.c

Signed-off-by: Chris Mason <chris.mason@oracle.com>
1  2 
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);