Re: [PATCH] ksmbd: set ATTR_CTIME flags when setting mtime

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 10, 2024 at 2:02 PM David Disseldorp <ddiss@xxxxxxx> wrote:
>
> Hi Namjae,
>
> On Sat,  7 Dec 2024 00:38:58 +0900, Namjae Jeon wrote:
> ...
> >  fs/smb/server/smb2pdu.c | 10 +++-------
> >  1 file changed, 3 insertions(+), 7 deletions(-)
> >
> > diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
> > index 5a70df87074c..803b35b89513 100644
> > --- a/fs/smb/server/smb2pdu.c
> > +++ b/fs/smb/server/smb2pdu.c
> > @@ -6026,15 +6026,13 @@ static int set_file_basic_info(struct ksmbd_file *fp,
> >               attrs.ia_valid |= (ATTR_ATIME | ATTR_ATIME_SET);
> >       }
> >
> > -     attrs.ia_valid |= ATTR_CTIME;
>
> This will mean that we now only call through to notify_change() on atime
> or mtime updates, which doesn't seem right. Can we get here with a valid
> file_info->ChangeTime only (i.e. no atime/mtime change)?
As you know, there is no ATTR_CTIME_SET to set ctime with given time.
And ctime is only updated to current time if ATTR_CTIME is set.
I couldn't find the way to update only ctime with given time.

And when setting mtime by this change, ctime will also be updated to
the current time.
This is also a problem. Let me know if you have idea.

Thanks.
>
> >       if (file_info->ChangeTime)
> > -             attrs.ia_ctime = ksmbd_NTtimeToUnix(file_info->ChangeTime);
> > -     else
> > -             attrs.ia_ctime = inode_get_ctime(inode);
> > +             inode_set_ctime_to_ts(inode,
> > +                             ksmbd_NTtimeToUnix(file_info->ChangeTime));
> >
> >       if (file_info->LastWriteTime) {
> >               attrs.ia_mtime = ksmbd_NTtimeToUnix(file_info->LastWriteTime);
> > -             attrs.ia_valid |= (ATTR_MTIME | ATTR_MTIME_SET);
> > +             attrs.ia_valid |= (ATTR_MTIME | ATTR_MTIME_SET | ATTR_CTIME);
> >       }
> >
> >       if (file_info->Attributes) {
> > @@ -6076,8 +6074,6 @@ static int set_file_basic_info(struct ksmbd_file *fp,
> >                       return -EACCES;
> >
> >               inode_lock(inode);
> > -             inode_set_ctime_to_ts(inode, attrs.ia_ctime);
> > -             attrs.ia_valid &= ~ATTR_CTIME;
> >               rc = notify_change(idmap, dentry, &attrs, NULL);
> >               inode_unlock(inode);
> >       }
>





[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux