diff options
author | Steve French <stfrench@microsoft.com> | 2023-08-30 22:48:41 -0500 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2023-08-31 10:06:36 -0500 |
commit | 238b351d0935df568ecb3dc5aef25971778f0f7c (patch) | |
tree | 1effd48a53e69677b6c7f1c70ea5d373c295a6b7 /fs/smb/client/cached_dir.c | |
parent | efc0b0bcffcba60d9c6301063d25a22a4744b499 (diff) | |
download | linux-stable-238b351d0935df568ecb3dc5aef25971778f0f7c.tar.gz linux-stable-238b351d0935df568ecb3dc5aef25971778f0f7c.tar.bz2 linux-stable-238b351d0935df568ecb3dc5aef25971778f0f7c.zip |
smb3: allow controlling length of time directory entries are cached with dir leases
Currently with directory leases we cache directory contents for a fixed period
of time (default 30 seconds) but for many workloads this is too short. Allow
configuring the maximum amount of time directory entries are cached when a
directory lease is held on that directory. Add module load parm "max_dir_cache"
For example to set the timeout to 10 minutes you would do:
echo 600 > /sys/module/cifs/parameters/dir_cache_timeout
or to disable caching directory contents:
echo 0 > /sys/module/cifs/parameters/dir_cache_timeout
Reviewed-by: Bharath SM <bharathsm@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/smb/client/cached_dir.c')
-rw-r--r-- | fs/smb/client/cached_dir.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/smb/client/cached_dir.c b/fs/smb/client/cached_dir.c index 2d5e9a9d5b8b..9d84c4a7bd0c 100644 --- a/fs/smb/client/cached_dir.c +++ b/fs/smb/client/cached_dir.c @@ -145,7 +145,7 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon, const char *npath; if (tcon == NULL || tcon->cfids == NULL || tcon->nohandlecache || - is_smb1_server(tcon->ses->server)) + is_smb1_server(tcon->ses->server) || (dir_cache_timeout == 0)) return -EOPNOTSUPP; ses = tcon->ses; @@ -582,7 +582,7 @@ cifs_cfids_laundromat_thread(void *p) return 0; spin_lock(&cfids->cfid_list_lock); list_for_each_entry_safe(cfid, q, &cfids->entries, entry) { - if (time_after(jiffies, cfid->time + HZ * 30)) { + if (time_after(jiffies, cfid->time + HZ * dir_cache_timeout)) { list_del(&cfid->entry); list_add(&cfid->entry, &entry); cfids->num_entries--; |