diff mbox series

[f2fs-dev,1/2,v2] f2fs: update mtime and ctime in move file range method

Message ID 20230625160627.4112651-1-heyunlei@oppo.com (mailing list archive)
State New
Headers show
Series [f2fs-dev,1/2,v2] f2fs: update mtime and ctime in move file range method | expand

Commit Message

Yunlei He June 25, 2023, 4:06 p.m. UTC
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>
---
v2:
-update both src and dst inode
 fs/f2fs/file.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Chao Yu June 26, 2023, 9:15 a.m. UTC | #1
On 2023/6/26 0:06, Yunlei He wrote:
> 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>

Thanks,
diff mbox series

Patch

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index cb42d8464ad9..5af7e57b6140 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2886,6 +2886,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);