diff options
author | Neil Brown <neilb@cse.unsw.edu.au> | 2004-08-22 23:02:41 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-08-22 23:02:41 -0700 |
commit | 29b7010fcb6dcaac642394d8f55afe21a1eea12a (patch) | |
tree | 6a0099fe91707c490d88731c2edd0bf10bd7dc86 /net | |
parent | eb229d253e6cf376756101ea3fdfd4a17edc5450 (diff) | |
download | history-29b7010fcb6dcaac642394d8f55afe21a1eea12a.tar.gz |
[PATCH] kNFSd: fix race with flushing nfsd cache.
To purge an nfsd-authentication cache, we set the flush time to later than
last-refresh time in the cache and call cache_flush. The easiest way to
find 'later than last-refresh' is 'now+1'.
This has two problems.
1/ if the time-of-day clock has gone bacwards, some entries might not
be purged
2/ if a new entry is added in the same second as cache_purge ran, it will
get ignored.
To resolve these issues, we set the flushtime to the maximum possible time
before calling cache_flush, and then set it back to the minimum time
afterwards.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/cache.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 1ceeb11591bfbe..d508a513d6322a 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -400,9 +400,10 @@ void cache_flush(void) void cache_purge(struct cache_detail *detail) { - detail->flush_time = get_seconds()+1; + detail->flush_time = LONG_MAX; detail->nextcheck = get_seconds(); cache_flush(); + detail->flush_time = 1; } |