Skip to content

Commit d5f13cf

Browse files
committed
ksmbd: fix corrupted mtime and ctime in smb2_open
If STATX_BASIC_STATS flags are not given as an argument to vfs_getattr, It can not get ctime and mtime in kstat. This causes a problem showing mtime and ctime outdated from cifs.ko. File: /xfstest.test/foo Size: 4096 Blocks: 8 IO Block: 1048576 regular file Device: 0,65 Inode: 2033391 Links: 1 Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) Context: system_u:object_r:cifs_t:s0 Access: 2025-07-23 22:15:30.136051900 +0100 Modify: 1970-01-01 01:00:00.000000000 +0100 Change: 1970-01-01 01:00:00.000000000 +0100 Birth: 2025-07-23 22:15:30.136051900 +0100 Reported-by: David Howells <[email protected]> Signed-off-by: Namjae Jeon <[email protected]>
1 parent efcfa5d commit d5f13cf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

vfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,8 @@ int ksmbd_vfs_getattr(const struct path *path, struct kstat *stat)
867867
{
868868
int err;
869869

870-
err = vfs_getattr(path, stat, STATX_BTIME, AT_STATX_SYNC_AS_STAT);
870+
err = vfs_getattr(path, stat, STATX_BASIC_STATS | STATX_BTIME,
871+
AT_STATX_SYNC_AS_STAT);
871872
if (err)
872873
pr_err("getattr failed, err %d\n", err);
873874
return err;

0 commit comments

Comments
 (0)