SUNRPC/cache: fix reporting of expired cache entries in 'content' file.
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Thanks! Applying for 3.6--b.
Quoted 62 lines · NeilBrown
Entries that are in a sunrpc cache but are not valid should be reported with a leading '#' so they look like a comment.
Commitd202cce8963d9(sunrpc: never return expired entries insunrpc_cache_lookup) broke this for expired entries.This particularly applies to entries that have been replaced by newer entries.
sunrpc_cache_updatesets the expiry of the replaced entry to '0', but it remains in the cache until the next 'cache_clean'.
The result is that if youecho 0 2000000000 1 0 >
/proc/net/rpc/auth.unix.gid/channelseveral times, then
cat
/proc/net/rpc/auth.unix.gid/contentIt will display multiple entries for the one uid, which is at least confusing:
#uid cnt: gids...
0 1: 0
0 1: 0
0 1: 0With this patch, expired entries are marked as comments so you get
#uid cnt: gids...
0 1: 0
# 0 1: 0
# 0 1: 0These expired entries will never be seen by
cache_check()as they are always *after* a non-expired entry with the same key - so the extra check is only needed inc_show()Signed-off-by NeilBrown <[email protected]>--
It's not a big problem, but it had me confused for a while, so it could well confuse others.
Thanks,
NeilBrownnet/sunrpc/cache.c +4
-1@@ -1349,8 +1349,11 @@ static int c_show(struct seq_file *m, void *p)if (cache_check (cd, cp,NULL ))/* cache_check does a cache_put on failure */ seq_printf (m,"# " ); -else +else { +if (cache_is_expired (cd, cp)) +seq_printf (m,"# " );cache_put (cp, cd); + }return cd->cache_show (m, cd, cp); }