mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ksmbd: set create_time to btime in ksmbd_vfs_fill_dentry_attrs()
@ 2026-11-10 16:16 koraynilay
  0 siblings, 0 replies; only message 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] only message in thread

only message in thread, other threads:[~2026-11-10 16:17 UTC | newest]

Thread overview: (only message) (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

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®