f2fs: update mtime and ctime in move file range method
authorYunlei He <heyunlei@oppo.com>
Thu, 22 Jun 2023 16:16:46 +0000 (00:16 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 26 Jun 2023 13:21:42 +0000 (06:21 -0700)
Mtime and ctime stay old value without update after move
file range ioctl. This patch add time update.

Signed-off-by: Yunlei He <heyunlei@oppo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/file.c

index 12ad128aefb75517c46cc01d31829050354ab8e6..fd2cde9d21b09864683320a8b0d06d9955ca1c52 100644 (file)
@@ -2878,6 +2878,17 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in,
                f2fs_up_write(&F2FS_I(dst)->i_gc_rwsem[WRITE]);
 out_src:
        f2fs_up_write(&F2FS_I(src)->i_gc_rwsem[WRITE]);
+       if (ret)
+               goto out_unlock;
+
+       src->i_mtime = src->i_ctime = current_time(src);
+       f2fs_mark_inode_dirty_sync(src, false);
+       if (src != dst) {
+               dst->i_mtime = dst->i_ctime = current_time(dst);
+               f2fs_mark_inode_dirty_sync(dst, false);
+       }
+       f2fs_update_time(sbi, REQ_TIME);
+
 out_unlock:
        if (src != dst)
                inode_unlock(dst);