Btrfs: add missing inode version, ctime and mtime updates when punching hole
[platform/kernel/linux-starfive.git] / fs / btrfs / file.c
index 5370152..b455bdf 100644 (file)
@@ -2711,6 +2711,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);