diff options
author | Josef Bacik <jbacik@fb.com> | 2014-11-06 10:19:54 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-01-08 10:27:49 -0800 |
commit | f9c9bec6a603e71d6296612627b830d93c2b78bf (patch) | |
tree | db8db22d64237366610137db8dae2351d1330ec7 | |
parent | 6f07df9bd9675d55a122d8fbdf2012e98b444756 (diff) | |
download | linux-stable-f9c9bec6a603e71d6296612627b830d93c2b78bf.tar.gz linux-stable-f9c9bec6a603e71d6296612627b830d93c2b78bf.tar.bz2 linux-stable-f9c9bec6a603e71d6296612627b830d93c2b78bf.zip |
Btrfs: make sure we wait on logged extents when fsycning two subvols
commit 9dba8cf128ef98257ca719722280c9634e7e9dc7 upstream.
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,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | fs/btrfs/tree-log.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 1d1ba083ca6e..e669f6bf4b7c 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -2598,9 +2598,9 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, if (atomic_read(&log_root_tree->log_commit[index2])) { blk_finish_plug(&plug); btrfs_wait_marked_extents(log, &log->dirty_log_pages, mark); + btrfs_wait_logged_extents(log, log_transid); wait_log_commit(trans, log_root_tree, root_log_ctx.log_transid); - btrfs_free_logged_extents(log, log_transid); mutex_unlock(&log_root_tree->log_mutex); ret = root_log_ctx.log_ret; goto out; |