diff options
| author | 2025-03-01 14:48:36 +0800 | |
|---|---|---|
| committer | 2025-05-11 19:48:22 -0400 | |
| commit | 2298abcbe11e9b553d03c0f1d084da786f7eff88 (patch) | |
| tree | 846c70211a1e6b189384535ae058cc8c660968c6 /include/uapi/linux/byteorder/ssh:/git@git.zx2c4.com | |
| parent | sunrpc: update nextcheck time when adding new cache entries (diff) | |
sunrpc: fix race in cache cleanup causing stale nextcheck time
When cache cleanup runs concurrently with cache entry removal, a race
condition can occur that leads to incorrect nextcheck times. This can
delay cache cleanup for the cache_detail by up to 1800 seconds:
1. cache_clean() sets nextcheck to current time plus 1800 seconds
2. While scanning a non-empty bucket, concurrent cache entry removal can
empty that bucket
3. cache_clean() finds no cache entries in the now-empty bucket to update
the nextcheck time
4. This maybe delays the next scan of the cache_detail by up to 1800
seconds even when it should be scanned earlier based on remaining
entries
Fix this by moving the hash_lock acquisition earlier in cache_clean().
This ensures bucket emptiness checks and nextcheck updates happen
atomically, preventing the race between cleanup and entry removal.
Signed-off-by: Long Li <leo.lilong@huawei.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'include/uapi/linux/byteorder/ssh:/git@git.zx2c4.com')
0 files changed, 0 insertions, 0 deletions
