Re: 回复: [PATCH 2/2] hfs: fix to update ctime after rename

From: Viacheslav Dubeyko
Date: Fri May 09 2025 - 15:03:03 EST


On Fri, 2025-05-09 at 10:51 -0700, Viacheslav Dubeyko wrote:
> On Wed, 2025-05-07 at 14:22 +0000, 李扬韬 wrote:
> > Hi Slava,
> >
> > >    +ERROR: access time has changed for file1 after remount
> > >    +ERROR: access time has changed after modifying file1
> > >    +ERROR: access time has changed for file in read-only
> > > filesystem
> >
> > > It looks like that it is not the whole fix of the issue for HFS
> > > case.
> >
> > The test cases that failed after applying this patch are all
> > related
> > to the atime not being updated,
>
> If I understood correctly "ERROR: access time has changed for file1
> after remount" means atime has been changed.
>
> > but hfs actually does not have atime.
> >
>
> But how the test detects that atime has been updated? If HFS hasn't
> atime, then test cannot detect such update, from my point of view.
>

As far as I can see, HFS code operates by atime [1 - 3]. As a result,
generic_fillattr [4] can retrieve the atime value. If we don't store
atime in the on-disk metadata, then the test could see inconsistent
atime value. I believe that dirMdDat/filMdDat (mtime) needs to be
considered as atime too. Because, modification cannot be done without
access action. So, atime == mtime.

Thanks,
Slava.

> > So the current fix is ​​sufficient, should we modify the 003 test
> > case?
> >
>
> I don't think so. Probably, something is wrong in HFS code. We need
> to
> double check it.
>
> Thanks,
> Slava.
>
> >    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}
> >
> > Thanks,
> > Yangtao

[1] https://elixir.bootlin.com/linux/v6.12.6/source/fs/hfs/sysdep.c#L35
[2] https://elixir.bootlin.com/linux/v6.12.6/source/fs/hfs/inode.c#L356
[3] https://elixir.bootlin.com/linux/v6.12.6/source/fs/hfs/inode.c#L367
[4] https://elixir.bootlin.com/linux/v6.12.6/source/fs/stat.c#L60