* [PATCH v3 1/3] hfsplus: fix to update ctime after rename
@ 2025-05-30 8:17 Yangtao Li
2025-05-30 8:17 ` [PATCH v3 2/3] hfs: correct superblock flags Yangtao Li
2025-05-30 8:17 ` [PATCH v3 3/3] hfs: fix to update ctime after rename Yangtao Li
0 siblings, 2 replies; 5+ messages in thread
From: Yangtao Li @ 2025-05-30 8:17 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 [flat|nested] 5+ messages in thread* [PATCH v3 2/3] hfs: correct superblock flags 2025-05-30 8:17 [PATCH v3 1/3] hfsplus: fix to update ctime after rename Yangtao Li @ 2025-05-30 8:17 ` Yangtao Li 2025-05-30 16:30 ` Viacheslav Dubeyko 2025-05-30 8:17 ` [PATCH v3 3/3] hfs: fix to update ctime after rename Yangtao Li 1 sibling, 1 reply; 5+ messages in thread From: Yangtao Li @ 2025-05-30 8:17 UTC (permalink / raw) To: slava, glaubitz, Yangtao Li; +Cc: linux-fsdevel, linux-kernel We don't support atime updates of any kind, because hfs actually does not have atime. dirCrDat: LongInt; {date and time of creation} dirMdDat: LongInt; {date and time of last modification} dirBkDat: LongInt; {date and time of last backup} filCrDat: LongInt; {date and time of creation} filMdDat: LongInt; {date and time of last modification} filBkDat: LongInt; {date and time of last backup} Signed-off-by: Yangtao Li <frank.li@vivo.com> --- fs/hfs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/hfs/super.c b/fs/hfs/super.c index fe09c2093a93..9fab84b157b4 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c @@ -331,7 +331,7 @@ static int hfs_fill_super(struct super_block *sb, struct fs_context *fc) sbi->sb = sb; sb->s_op = &hfs_super_operations; sb->s_xattr = hfs_xattr_handlers; - sb->s_flags |= SB_NODIRATIME; + sb->s_flags |= SB_NOATIME; mutex_init(&sbi->bitmap_lock); res = hfs_mdb_get(sb); -- 2.48.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 2/3] hfs: correct superblock flags 2025-05-30 8:17 ` [PATCH v3 2/3] hfs: correct superblock flags Yangtao Li @ 2025-05-30 16:30 ` Viacheslav Dubeyko 0 siblings, 0 replies; 5+ messages in thread From: Viacheslav Dubeyko @ 2025-05-30 16:30 UTC (permalink / raw) To: frank.li, glaubitz, slava; +Cc: linux-fsdevel, linux-kernel On Fri, 2025-05-30 at 02:17 -0600, Yangtao Li wrote: > We don't support atime updates of any kind, > because hfs actually does not have atime. > > dirCrDat: LongInt; {date and time of creation} > dirMdDat: LongInt; {date and time of last modification} > dirBkDat: LongInt; {date and time of last backup} > > filCrDat: LongInt; {date and time of creation} > filMdDat: LongInt; {date and time of last modification} > filBkDat: LongInt; {date and time of last backup} > > Signed-off-by: Yangtao Li <frank.li@vivo.com> > --- > fs/hfs/super.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/hfs/super.c b/fs/hfs/super.c > index fe09c2093a93..9fab84b157b4 100644 > --- a/fs/hfs/super.c > +++ b/fs/hfs/super.c > @@ -331,7 +331,7 @@ static int hfs_fill_super(struct super_block *sb, struct fs_context *fc) > sbi->sb = sb; > sb->s_op = &hfs_super_operations; > sb->s_xattr = hfs_xattr_handlers; > - sb->s_flags |= SB_NODIRATIME; > + sb->s_flags |= SB_NOATIME; I don't agree with this patch. From my point of view, SB_NODIRATIME flag is associated with nodiratime mount option and SB_NOATIME is associated with noatime mount option. I prefer to have it both. Thanks, Slava. > mutex_init(&sbi->bitmap_lock); > > res = hfs_mdb_get(sb); ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 3/3] hfs: fix to update ctime after rename 2025-05-30 8:17 [PATCH v3 1/3] hfsplus: fix to update ctime after rename Yangtao Li 2025-05-30 8:17 ` [PATCH v3 2/3] hfs: correct superblock flags Yangtao Li @ 2025-05-30 8:17 ` Yangtao Li 2025-05-30 16:33 ` Viacheslav Dubeyko 1 sibling, 1 reply; 5+ messages in thread From: Yangtao Li @ 2025-05-30 8:17 UTC (permalink / raw) To: slava, glaubitz, Yangtao Li; +Cc: linux-fsdevel, linux-kernel Similar to hfsplus, let's update file ctime after the rename operation in hfs_rename(). W/O patch(xfstest generic/003): +ERROR: access time has not been updated after accessing file1 first time +ERROR: access time has not been updated after accessing file2 +ERROR: access time has changed after modifying file1 +ERROR: change time has not been updated after changing file1 +ERROR: access time has not been updated after accessing file3 second time +ERROR: access time has not been updated after accessing file3 third time W/ patch(xfstest generic/003): +ERROR: access time has not been updated after accessing file1 first time +ERROR: access time has not been updated after accessing file2 +ERROR: access time has changed after modifying file1 +ERROR: access time has not been updated after accessing file3 second time +ERROR: access time has not been updated after accessing file3 third time Signed-off-by: Yangtao Li <frank.li@vivo.com> --- fs/hfs/dir.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c index 86a6b317b474..756ea7b895e2 100644 --- a/fs/hfs/dir.c +++ b/fs/hfs/dir.c @@ -284,6 +284,7 @@ static int hfs_rename(struct mnt_idmap *idmap, struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags) { + struct inode *inode = d_inode(old_dentry); int res; if (flags & ~RENAME_NOREPLACE) @@ -296,14 +297,16 @@ static int hfs_rename(struct mnt_idmap *idmap, struct inode *old_dir, return res; } - res = hfs_cat_move(d_inode(old_dentry)->i_ino, - old_dir, &old_dentry->d_name, + res = hfs_cat_move(inode->i_ino, old_dir, &old_dentry->d_name, new_dir, &new_dentry->d_name); - if (!res) - hfs_cat_build_key(old_dir->i_sb, - (btree_key *)&HFS_I(d_inode(old_dentry))->cat_key, - new_dir->i_ino, &new_dentry->d_name); - return res; + if (res) + return res; + + hfs_cat_build_key(old_dir->i_sb, (btree_key *)&HFS_I(inode)->cat_key, + new_dir->i_ino, &new_dentry->d_name); + inode_set_ctime_current(inode); + mark_inode_dirty(inode); + return 0; } const struct file_operations hfs_dir_operations = { -- 2.48.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 3/3] hfs: fix to update ctime after rename 2025-05-30 8:17 ` [PATCH v3 3/3] hfs: fix to update ctime after rename Yangtao Li @ 2025-05-30 16:33 ` Viacheslav Dubeyko 0 siblings, 0 replies; 5+ messages in thread From: Viacheslav Dubeyko @ 2025-05-30 16:33 UTC (permalink / raw) To: frank.li, glaubitz, slava; +Cc: linux-fsdevel, linux-kernel On Fri, 2025-05-30 at 02:17 -0600, Yangtao Li wrote: > Similar to hfsplus, let's update file ctime after the rename operation > in hfs_rename(). > > W/O patch(xfstest generic/003): > > +ERROR: access time has not been updated after accessing file1 first time > +ERROR: access time has not been updated after accessing file2 > +ERROR: access time has changed after modifying file1 > +ERROR: change time has not been updated after changing file1 > +ERROR: access time has not been updated after accessing file3 second time > +ERROR: access time has not been updated after accessing file3 third time > > W/ patch(xfstest generic/003): > > +ERROR: access time has not been updated after accessing file1 first time > +ERROR: access time has not been updated after accessing file2 > +ERROR: access time has changed after modifying file1 > +ERROR: access time has not been updated after accessing file3 second time > +ERROR: access time has not been updated after accessing file3 third time > I still don't understand this comment. What does finally this patch fix? Thanks, Slava. > Signed-off-by: Yangtao Li <frank.li@vivo.com> > --- > fs/hfs/dir.c | 17 ++++++++++------- > 1 file changed, 10 insertions(+), 7 deletions(-) > > diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c > index 86a6b317b474..756ea7b895e2 100644 > --- a/fs/hfs/dir.c > +++ b/fs/hfs/dir.c > @@ -284,6 +284,7 @@ static int hfs_rename(struct mnt_idmap *idmap, struct inode *old_dir, > struct dentry *old_dentry, struct inode *new_dir, > struct dentry *new_dentry, unsigned int flags) > { > + struct inode *inode = d_inode(old_dentry); > int res; > > if (flags & ~RENAME_NOREPLACE) > @@ -296,14 +297,16 @@ static int hfs_rename(struct mnt_idmap *idmap, struct inode *old_dir, > return res; > } > > - res = hfs_cat_move(d_inode(old_dentry)->i_ino, > - old_dir, &old_dentry->d_name, > + res = hfs_cat_move(inode->i_ino, old_dir, &old_dentry->d_name, > new_dir, &new_dentry->d_name); > - if (!res) > - hfs_cat_build_key(old_dir->i_sb, > - (btree_key *)&HFS_I(d_inode(old_dentry))->cat_key, > - new_dir->i_ino, &new_dentry->d_name); > - return res; > + if (res) > + return res; > + > + hfs_cat_build_key(old_dir->i_sb, (btree_key *)&HFS_I(inode)->cat_key, > + new_dir->i_ino, &new_dentry->d_name); > + inode_set_ctime_current(inode); > + mark_inode_dirty(inode); > + return 0; > } > > const struct file_operations hfs_dir_operations = { ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-05-30 16:33 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2025-05-30 8:17 [PATCH v3 1/3] hfsplus: fix to update ctime after rename Yangtao Li 2025-05-30 8:17 ` [PATCH v3 2/3] hfs: correct superblock flags Yangtao Li 2025-05-30 16:30 ` Viacheslav Dubeyko 2025-05-30 8:17 ` [PATCH v3 3/3] hfs: fix to update ctime after rename Yangtao Li 2025-05-30 16:33 ` Viacheslav Dubeyko
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®