* [PATCH] ksmbd: set create_time to btime in ksmbd_vfs_fill_dentry_attrs()
@ 2026-11-10 16:16 koraynilay
2026-11-10 19:56 ` Ian Bridges
0 siblings, 1 reply; 4+ messages in thread
From: koraynilay @ 2026-11-10 16:16 UTC (permalink / raw)
To: Namjae Jeon
Cc: Sergey Senozhatsky, Tom Talpey, ChenXiaoSong, Marios Makassikis,
linux-cifs, linux-kernel, koraynilay
ksmbd_vfs_fill_dentry_attrs() queries vfs_getattr() with STATX_BTIME,
but discards ksmbd_kstat->kstat->btime and unconditionally initializes
ksmbd_kstat->create_time to ksmbd_kstat->kstat->ctime.
Check ksmbd_kstat->kstat->result_mask for STATX_BTIME and set
ksmbd_kstat->create_time to ksmbd_kstat->kstat->btime, only falling back
to ctime if btime isn't returned, matching the existing behavior in
smb2_open().
Fixes: 5614c8c487f6 ("ksmbd: replace generic_fillattr with vfs_getattr")
Cc: stable@vger.kernel.org
Assisted-by: Gemini:3.8-flash-high antigravity-cli-1.5.3
Signed-off-by: koraynilay <koray.fra@gmail.com>
---
Small fix I found while implementing ptime[1].
Thanks.
[1]: https://lore.kernel.org/all/20261101015551.786044-1-koray.fra@gmail.com/T/#t
fs/smb/server/vfs.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/smb/server/vfs.c b/fs/smb/server/vfs.c
index cb3f4f5fe9cf..0c95d4668370 100644
--- a/fs/smb/server/vfs.c
+++ b/fs/smb/server/vfs.c
@@ -1914,7 +1914,10 @@ int ksmbd_vfs_fill_dentry_attrs(struct ksmbd_work *work,
if (rc)
return rc;
- time = ksmbd_UnixTimeToNT(ksmbd_kstat->kstat->ctime);
+ if (ksmbd_kstat->kstat->result_mask & STATX_BTIME)
+ time = ksmbd_UnixTimeToNT(ksmbd_kstat->kstat->btime);
+ else
+ time = ksmbd_UnixTimeToNT(ksmbd_kstat->kstat->ctime);
ksmbd_kstat->create_time = time;
/*
base-commit: b0af9a3e6b1534d353ca6ac23caaf46127f62e4a
--
2.56.0
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ksmbd: set create_time to btime in ksmbd_vfs_fill_dentry_attrs()
2026-11-10 16:16 [PATCH] ksmbd: set create_time to btime in ksmbd_vfs_fill_dentry_attrs() koraynilay
@ 2026-11-10 19:56 ` Ian Bridges
2026-11-10 22:45 ` Namjae Jeon
0 siblings, 1 reply; 4+ messages in thread
From: Ian Bridges @ 2026-11-10 19:56 UTC (permalink / raw)
To: koray.fra
Cc: linkinjeon, senozhatsky, tom, chenxiaosong, mmakassikis,
linux-cifs, linux-kernel, Ian Bridges
Hi,
On Tue, Nov 10, 2026 at 05:16:59PM +0100, koraynilay wrote:
> ksmbd_vfs_fill_dentry_attrs() queries vfs_getattr() with STATX_BTIME,
> but discards ksmbd_kstat->kstat->btime and unconditionally initializes
> ksmbd_kstat->create_time to ksmbd_kstat->kstat->ctime.
I tested this on a kernel whose fs/smb/server matches ksmbd-for-next,
with files and a directory created on the server, so without the DOS
attribute xattr. Before the patch, a directory listing reported their
ctime as the creation time, while a query on the open file reported
the btime. With the patch, both report the btime. A file created over
SMB keeps its stored creation time in both. smbtorture gives the same
results as without the patch, and KASAN reports nothing.
Reviewed-by: Ian Bridges <icb@fastmail.org>
Tested-by: Ian Bridges <icb@fastmail.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ksmbd: set create_time to btime in ksmbd_vfs_fill_dentry_attrs()
2026-11-10 19:56 ` Ian Bridges
@ 2026-11-10 22:45 ` Namjae Jeon
2026-11-10 23:38 ` koraynilay
0 siblings, 1 reply; 4+ messages in thread
From: Namjae Jeon @ 2026-11-10 22:45 UTC (permalink / raw)
To: koray.fra, Ian Bridges
Cc: senozhatsky, tom, chenxiaosong, mmakassikis, linux-cifs, linux-kernel
On Wed, Nov 11, 2026 at 4:56 AM Ian Bridges <icb@fastmail.org> wrote:
>
> Hi,
>
> On Tue, Nov 10, 2026 at 05:16:59PM +0100, koraynilay wrote:
> > ksmbd_vfs_fill_dentry_attrs() queries vfs_getattr() with STATX_BTIME,
> > but discards ksmbd_kstat->kstat->btime and unconditionally initializes
> > ksmbd_kstat->create_time to ksmbd_kstat->kstat->ctime.
>
> I tested this on a kernel whose fs/smb/server matches ksmbd-for-next,
> with files and a directory created on the server, so without the DOS
> attribute xattr. Before the patch, a directory listing reported their
> ctime as the creation time, while a query on the open file reported
> the btime. With the patch, both report the btime. A file created over
> SMB keeps its stored creation time in both. smbtorture gives the same
> results as without the patch, and KASAN reports nothing.
>
> Reviewed-by: Ian Bridges <icb@fastmail.org>
> Tested-by: Ian Bridges <icb@fastmail.org>
Applied this patch to #ksmbd-for-next.
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ksmbd: set create_time to btime in ksmbd_vfs_fill_dentry_attrs()
2026-11-10 22:45 ` Namjae Jeon
@ 2026-11-10 23:38 ` koraynilay
0 siblings, 0 replies; 4+ messages in thread
From: koraynilay @ 2026-11-10 23:38 UTC (permalink / raw)
To: Namjae Jeon, koray.fra, Ian Bridges
Cc: senozhatsky, tom, chenxiaosong, mmakassikis, linux-cifs, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1115 bytes --]
On Tue Nov 10, 2026 at 11:45 PM CET, Namjae Jeon wrote:
> On Wed, Nov 11, 2026 at 4:56 AM Ian Bridges <icb@fastmail.org> wrote:
>>
>> Hi,
>>
>> On Tue, Nov 10, 2026 at 05:16:59PM +0100, koraynilay wrote:
>> > ksmbd_vfs_fill_dentry_attrs() queries vfs_getattr() with STATX_BTIME,
>> > but discards ksmbd_kstat->kstat->btime and unconditionally initializes
>> > ksmbd_kstat->create_time to ksmbd_kstat->kstat->ctime.
>>
>> I tested this on a kernel whose fs/smb/server matches ksmbd-for-next,
>> with files and a directory created on the server, so without the DOS
>> attribute xattr. Before the patch, a directory listing reported their
>> ctime as the creation time, while a query on the open file reported
>> the btime. With the patch, both report the btime. A file created over
>> SMB keeps its stored creation time in both. smbtorture gives the same
>> results as without the patch, and KASAN reports nothing.
>>
>> Reviewed-by: Ian Bridges <icb@fastmail.org>
>> Tested-by: Ian Bridges <icb@fastmail.org>
> Applied this patch to #ksmbd-for-next.
> Thanks!
Thanks!
Best,
koraynilay
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-10 23:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-10 16:16 [PATCH] ksmbd: set create_time to btime in ksmbd_vfs_fill_dentry_attrs() koraynilay
2026-11-10 19:56 ` Ian Bridges
2026-11-10 22:45 ` Namjae Jeon
2026-11-10 23:38 ` koraynilay
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®