linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/3] hfsplus: fix to update ctime after rename
@ 2025-05-19 16:52 Yangtao Li
  2025-05-19 16:52 ` [PATCH v2 2/3] hfs: correct superblock flags Yangtao Li
  2025-05-19 16:52 ` [PATCH v2 3/3] hfs: fix to update ctime after rename Yangtao Li
  0 siblings, 2 replies; 14+ messages in thread
From: Yangtao Li @ 2025-05-19 16:52 UTC (permalink / raw)
  To: slava, glaubitz, Yangtao Li; +Cc: linux-fsdevel, linux-kernel

[BUG]
$ sudo ./check generic/003
FSTYP         -- hfsplus
PLATFORM      -- Linux/x86_64 graphic 6.8.0-58-generic #60~22.04.1-Ubuntu
MKFS_OPTIONS  -- /dev/loop29
MOUNT_OPTIONS -- /dev/loop29 /mnt/scratch

generic/003       - output mismatch
    --- tests/generic/003.out   2025-04-27 08:49:39.876945323 -0600
    +++ /home/graphic/fs/xfstests-dev/results//generic/003.out.bad

     QA output created by 003
    +ERROR: change time has not been updated after changing file1
     Silence is golden
    ...

Ran: generic/003
Failures: generic/003
Failed 1 of 1 tests

[CAUSE]
change time has not been updated after changing file1

[FIX]
Update file ctime after rename in hfsplus_rename().

Signed-off-by: Yangtao Li <frank.li@vivo.com>
Tested-by: Viacheslav Dubeyko <slava@dubeyko.com>
Reviewed-by: Viacheslav Dubeyko <slava@dubeyko.com>
---
 fs/hfsplus/dir.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 876bbb80fb4d..e77942440240 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -534,6 +534,7 @@ static int hfsplus_rename(struct mnt_idmap *idmap,
 			  struct inode *new_dir, struct dentry *new_dentry,
 			  unsigned int flags)
 {
+	struct inode *inode = d_inode(old_dentry);
 	int res;
 
 	if (flags & ~RENAME_NOREPLACE)
@@ -552,9 +553,13 @@ static int hfsplus_rename(struct mnt_idmap *idmap,
 	res = hfsplus_rename_cat((u32)(unsigned long)old_dentry->d_fsdata,
 				 old_dir, &old_dentry->d_name,
 				 new_dir, &new_dentry->d_name);
-	if (!res)
-		new_dentry->d_fsdata = old_dentry->d_fsdata;
-	return res;
+	if (res)
+		return res;
+
+	new_dentry->d_fsdata = old_dentry->d_fsdata;
+	inode_set_ctime_current(inode);
+	mark_inode_dirty(inode);
+	return 0;
 }
 
 const struct inode_operations hfsplus_dir_inode_operations = {
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2025-05-30  7:50 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-19 16:52 [PATCH v2 1/3] hfsplus: fix to update ctime after rename Yangtao Li
2025-05-19 16:52 ` [PATCH v2 2/3] hfs: correct superblock flags Yangtao Li
2025-05-27 22:36   ` Viacheslav Dubeyko
2025-05-28 16:37     ` 回复: " 李扬韬
2025-05-28 21:26       ` Viacheslav Dubeyko
2025-05-29  2:25         ` Yangtao Li
2025-05-30  5:21           ` Christian Brauner
2025-05-30  7:50             ` Yangtao Li
2025-05-28 16:56     ` 回复: " 李扬韬
2025-05-28 17:04       ` Viacheslav Dubeyko
2025-05-19 16:52 ` [PATCH v2 3/3] hfs: fix to update ctime after rename Yangtao Li
2025-05-27 22:46   ` Viacheslav Dubeyko
2025-05-28  1:37     ` Viacheslav Dubeyko
2025-05-28 16:50       ` 回复: " 李扬韬

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).