]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
smb: invalidate and close cached directory when creating child entries
authorBharath SM <bharathsm@microsoft.com>
Mon, 30 Jun 2025 18:53:03 +0000 (00:23 +0530)
committerSteve French <stfrench@microsoft.com>
Sun, 13 Jul 2025 22:16:29 +0000 (17:16 -0500)
commit83898e4a858387c88cd7456f713cb8fd49440cf9
tree6282fa0b2488e2098ebd5ee3c3e9f01ec55df540
parentb220bed63330c0e1733dc06ea8e75d5b9962b6b6
smb: invalidate and close cached directory when creating child entries

When a parent lease key is passed to the server during a create operation
while holding a directory lease, the server may not send a lease break to
the client. In such cases, it becomes the client’s responsibility to
ensure cache consistency.

This led to a problem where directory listings (e.g., `ls` or `readdir`)
could return stale results after a new file is created.
eg:
ls /mnt/share/
touch /mnt/share/file1
ls /mnt/share/

In this scenario, the final `ls` may not show  `file1` due to the stale
directory cache.

For now, fix this by marking the cached directory as invalid if using
the parent lease key during create, and explicitly closing the cached
directory after successful file creation.

Fixes: 037e1bae588eacf ("smb: client: use ParentLeaseKey in cifs_do_create")
Signed-off-by: Bharath SM <bharathsm@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/dir.c