aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2014-11-06 10:19:54 -0500
committerChris Mason <clm@fb.com>2014-11-20 20:20:10 -0500
commit9dba8cf128ef98257ca719722280c9634e7e9dc7 (patch)
treec8ad17c372a4a8c8f8fdfd49c27cf93ab473fbbc
parent0d95c1bec906dd1ad951c9c001e798ca52baeb0f (diff)
Btrfs: make sure we wait on logged extents when fsycning two subvols
If we have two fsync()'s race on different subvols one will do all of its work to get into the log_tree, wait on it's outstanding IO, and then allow the log_tree to finish it's commit. The problem is we were just free'ing that subvols logged extents instead of waiting on them, so whoever lost the race wouldn't really have their data on disk. Fix this by waiting properly instead of freeing the logged extents. Thanks, cc: stable@vger.kernel.org Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r--fs/btrfs/tree-log.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 286213cec861..fc715ff31d26 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -2600,9 +2600,9 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
2600 if (atomic_read(&log_root_tree->log_commit[index2])) { 2600 if (atomic_read(&log_root_tree->log_commit[index2])) {
2601 blk_finish_plug(&plug); 2601 blk_finish_plug(&plug);
2602 btrfs_wait_marked_extents(log, &log->dirty_log_pages, mark); 2602 btrfs_wait_marked_extents(log, &log->dirty_log_pages, mark);
2603 btrfs_wait_logged_extents(log, log_transid);
2603 wait_log_commit(trans, log_root_tree, 2604 wait_log_commit(trans, log_root_tree,
2604 root_log_ctx.log_transid); 2605 root_log_ctx.log_transid);
2605 btrfs_free_logged_extents(log, log_transid);
2606 mutex_unlock(&log_root_tree->log_mutex); 2606 mutex_unlock(&log_root_tree->log_mutex);
2607 ret = root_log_ctx.log_ret; 2607 ret = root_log_ctx.log_ret;
2608 goto out; 2608 goto out;