* [PATCH] f2fs: update inode ctime on exchange rename
@ 2026-11-02 0:47 Hungyu Lin
2026-11-02 2:41 ` Chao Yu
0 siblings, 1 reply; 2+ messages in thread
From: Hungyu Lin @ 2026-11-02 0:47 UTC (permalink / raw)
To: Jaegeuk Kim; +Cc: Chao Yu, linux-f2fs-devel, linux-kernel, Hungyu Lin
When two regular files are exchanged with renameat2(RENAME_EXCHANGE),
their ctimes remain unchanged. f2fs_cross_rename() applies its explicit
ctime updates and dirty marking to old_dir and new_dir, which have
already been updated by f2fs_set_link().
Update old_inode and new_inode instead, matching the ordinary rename
path. Keep the existing parent link-count handling, which dirties the
parents through f2fs_i_links_write().
Fixes: 32f9bc25cbda ("f2fs: support ->rename2()")
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
fs/f2fs/namei.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index ce5d536d892b..880dfd44c04a 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -1287,13 +1287,13 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
f2fs_i_pino_write(old_inode, new_dir->i_ino);
f2fs_up_write(&F2FS_I(old_inode)->i_sem);
- inode_set_ctime_current(old_dir);
+ inode_set_ctime_current(old_inode);
if (old_nlink) {
f2fs_down_write(&F2FS_I(old_dir)->i_sem);
f2fs_i_links_write(old_dir, old_nlink > 0);
f2fs_up_write(&F2FS_I(old_dir)->i_sem);
}
- f2fs_mark_inode_dirty_sync(old_dir, true);
+ f2fs_mark_inode_dirty_sync(old_inode, true);
/* update directory entry info of new dir inode */
f2fs_set_link(new_dir, new_entry, new_block, old_inode);
@@ -1306,13 +1306,13 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
f2fs_i_pino_write(new_inode, old_dir->i_ino);
f2fs_up_write(&F2FS_I(new_inode)->i_sem);
- inode_set_ctime_current(new_dir);
+ inode_set_ctime_current(new_inode);
if (new_nlink) {
f2fs_down_write(&F2FS_I(new_dir)->i_sem);
f2fs_i_links_write(new_dir, new_nlink > 0);
f2fs_up_write(&F2FS_I(new_dir)->i_sem);
}
- f2fs_mark_inode_dirty_sync(new_dir, true);
+ f2fs_mark_inode_dirty_sync(new_inode, true);
if (F2FS_OPTION(sbi).fsync_mode == FSYNC_MODE_STRICT) {
f2fs_add_ino_entry(sbi, old_dir->i_ino, TRANS_DIR_INO);
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] f2fs: update inode ctime on exchange rename
2026-11-02 0:47 [PATCH] f2fs: update inode ctime on exchange rename Hungyu Lin
@ 2026-11-02 2:41 ` Chao Yu
0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2026-11-02 2:41 UTC (permalink / raw)
To: Hungyu Lin, Jaegeuk Kim; +Cc: chao, linux-f2fs-devel, linux-kernel
On 11/2/26 08:47, Hungyu Lin wrote:
> When two regular files are exchanged with renameat2(RENAME_EXCHANGE),
> their ctimes remain unchanged. f2fs_cross_rename() applies its explicit
> ctime updates and dirty marking to old_dir and new_dir, which have
> already been updated by f2fs_set_link().
>
> Update old_inode and new_inode instead, matching the ordinary rename
> path. Keep the existing parent link-count handling, which dirties the
> parents through f2fs_i_links_write().
>
Cc: stable@vger.kernel.org
> Fixes: 32f9bc25cbda ("f2fs: support ->rename2()")
> Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-02 2:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-02 0:47 [PATCH] f2fs: update inode ctime on exchange rename Hungyu Lin
2026-11-02 2:41 ` Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®