aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c14
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,
1298 schedule_timeout(1); 1298 schedule_timeout(1);
1299 1299
1300 finish_wait(&cur_trans->writer_wait, &wait); 1300 finish_wait(&cur_trans->writer_wait, &wait);
1301 spin_lock(&root->fs_info->trans_lock);
1302 root->fs_info->trans_no_join = 1;
1303 spin_unlock(&root->fs_info->trans_lock);
1304 } while (atomic_read(&cur_trans->num_writers) > 1 || 1301 } while (atomic_read(&cur_trans->num_writers) > 1 ||
1305 (should_grow && cur_trans->num_joined != joined)); 1302 (should_grow && cur_trans->num_joined != joined));
1306 1303
1307 /* 1304 /*
1305 * Ok now we need to make sure to block out any other joins while we
1306 * commit the transaction. We could have started a join before setting
1307 * no_join so make sure to wait for num_writers to == 1 again.
1308 */
1309 spin_lock(&root->fs_info->trans_lock);
1310 root->fs_info->trans_no_join = 1;
1311 spin_unlock(&root->fs_info->trans_lock);
1312 wait_event(cur_trans->writer_wait,
1313 atomic_read(&cur_trans->num_writers) == 1);
1314
1315 /*
1308 * the reloc mutex makes sure that we stop 1316 * the reloc mutex makes sure that we stop
1309 * the balancing code from coming in and moving 1317 * the balancing code from coming in and moving
1310 * extents around in the middle of the commit 1318 * extents around in the middle of the commit