Btrfs: add missing inode version, ctime and mtime updates when punching hole
PATCH 1/1 Btrfs: add missing inode version, ctime and mtime updates when punching hole
From: Filipe Manana <[email protected]>
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.
--- fs/btrfs/file.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/btrfs/file.c +5 -0
@@ -2721,6 +2721,11 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len)* 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);
Signature · 1 line
2.11.0
Quoted 7 lines · On Wed, Jun 19, 2019 at 01:05:50PM +0100, [email protected] wrote:
From: Filipe Manana <[email protected]>
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.
Quoted 6 lines
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")Signed-off-by Filipe Manana <[email protected]>
Added to misc-next, thanks.