summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorFilipe Manana2019-06-19 14:05:50 +0200
committerGreg Kroah-Hartman2019-07-26 09:14:27 +0200
commit4bd953241d81fc9bb00210859346a0a3db2e3ef6 (patch)
treecb15a4305b0737353774a7d411c8e15263c1ec79 /fs
parentBtrfs: fix fsync not persisting dentry deletions due to inode evictions (diff)
downloadkernel-qcow2-linux-4bd953241d81fc9bb00210859346a0a3db2e3ef6.tar.gz
kernel-qcow2-linux-4bd953241d81fc9bb00210859346a0a3db2e3ef6.tar.xz
kernel-qcow2-linux-4bd953241d81fc9bb00210859346a0a3db2e3ef6.zip
Btrfs: add missing inode version, ctime and mtime updates when punching hole
commit 179006688a7e888cbff39577189f2e034786d06a upstream. If the range for which we are punching a hole covers only part of a page, we end up updating the inode item but we skip the update of the inode's iversion, mtime and ctime. Fix that by ensuring we update those properties of the inode. A patch for fstests test case generic/059 that tests this as been sent along with this fix. Fixes: 2aaa66558172b0 ("Btrfs: add hole punching") Fixes: e8c1c76e804b18 ("Btrfs: add missing inode update when punching hole") CC: stable@vger.kernel.org # 4.4+ Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/file.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index e24c0a69ff5d..c84186563c31 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2732,6 +2732,11 @@ out_only_mutex:
* for detecting, at fsync time, if the inode isn't yet in the
* log tree or it's there but not up to date.
*/
+ struct timespec64 now = current_time(inode);
+
+ inode_inc_iversion(inode);
+ inode->i_mtime = now;
+ inode->i_ctime = now;
trans = btrfs_start_transaction(root, 1);
if (IS_ERR(trans)) {
err = PTR_ERR(trans);