summaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2019-06-19 13:05:50 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-07-26 09:11:05 +0200
commitb6a0d03dd4ea4733aaaf0a7e5c4beaaf8ac10306 (patch)
tree175ebfaa7a9dddf18e29aad0a0f311f7696f9a9e /fs/btrfs
parent24ae804edf6d76bb7c6c7d64c5a331c8c482f7c4 (diff)
downloadlinux-stable-b6a0d03dd4ea4733aaaf0a7e5c4beaaf8ac10306.tar.gz
linux-stable-b6a0d03dd4ea4733aaaf0a7e5c4beaaf8ac10306.tar.bz2
linux-stable-b6a0d03dd4ea4733aaaf0a7e5c4beaaf8ac10306.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/btrfs')
-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 89f5be2bfb43..1c7533db16b0 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2721,6 +2721,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);