This is a note to let you know that I've just added the patch titled Btrfs: make sure we wait on logged extents when fsycning two subvols to the 3.17-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: btrfs-make-sure-we-wait-on-logged-extents-when-fsycning-two-subvols.patch and it can be found in the queue-3.17 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 9dba8cf128ef98257ca719722280c9634e7e9dc7 Mon Sep 17 00:00:00 2001 From: Josef Bacik <jbacik@xxxxxx> Date: Thu, 6 Nov 2014 10:19:54 -0500 Subject: Btrfs: make sure we wait on logged extents when fsycning two subvols From: Josef Bacik <jbacik@xxxxxx> 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@xxxxxx> Signed-off-by: Chris Mason <clm@xxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/btrfs/tree-log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -2598,9 +2598,9 @@ int btrfs_sync_log(struct btrfs_trans_ha 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; Patches currently in stable-queue which might be from jbacik@xxxxxx are queue-3.17/btrfs-make-sure-logged-extents-complete-in-the-current-transaction-v3.patch queue-3.17/btrfs-do-not-move-em-to-modified-list-when-unpinning.patch queue-3.17/btrfs-make-sure-we-wait-on-logged-extents-when-fsycning-two-subvols.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html