This is a note to let you know that I've just added the patch titled Btrfs: fix filemap_flush call in btrfs_file_release to the 3.16-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-fix-filemap_flush-call-in-btrfs_file_release.patch and it can be found in the queue-3.16 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From f6dc45c7a93a011dff6eb9b2ffda59c390c7705a Mon Sep 17 00:00:00 2001 From: Chris Mason <clm@xxxxxx> Date: Wed, 20 Aug 2014 07:15:33 -0700 Subject: Btrfs: fix filemap_flush call in btrfs_file_release From: Chris Mason <clm@xxxxxx> commit f6dc45c7a93a011dff6eb9b2ffda59c390c7705a upstream. We should only be flushing on close if the file was flagged as needing it during truncate. I broke this with my ordered data vs transaction commit deadlock fix. Thanks to Miao Xie for catching this. Signed-off-by: Chris Mason <clm@xxxxxx> Reported-by: Miao Xie <miaox@xxxxxxxxxxxxxx> Reported-by: Fengguang Wu <fengguang.wu@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/btrfs/file.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1840,7 +1840,15 @@ int btrfs_release_file(struct inode *ino { if (filp->private_data) btrfs_ioctl_trans_end(filp); - filemap_flush(inode->i_mapping); + /* + * ordered_data_close is set by settattr when we are about to truncate + * a file from a non-zero size to a zero size. This tries to + * flush down new bytes that may have been written if the + * application were using truncate to replace a file in place. + */ + if (test_and_clear_bit(BTRFS_INODE_ORDERED_DATA_CLOSE, + &BTRFS_I(inode)->runtime_flags)) + filemap_flush(inode->i_mapping); return 0; } Patches currently in stable-queue which might be from clm@xxxxxx are queue-3.16/btrfs-fix-task-hang-under-heavy-compressed-write.patch queue-3.16/btrfs-fix-memory-corruption-by-ulist_add_merge-on-32bit-arch.patch queue-3.16/btrfs-fix-filemap_flush-call-in-btrfs_file_release.patch queue-3.16/btrfs-fix-crash-on-endio-of-reading-corrupted-block.patch queue-3.16/btrfs-fix-csum-tree-corruption-duplicate-and-outdated-checksums.patch queue-3.16/btrfs-read-lock-extent-buffer-while-walking-backrefs.patch queue-3.16/btrfs-fix-compressed-write-corruption-on-enospc.patch queue-3.16/btrfs-disable-strict-file-flushes-for-renames-and-truncates.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