Commit 29b7010f authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[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: default avatarNeil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent eb229d25
...@@ -400,9 +400,10 @@ void cache_flush(void) ...@@ -400,9 +400,10 @@ void cache_flush(void)
void cache_purge(struct cache_detail *detail) void cache_purge(struct cache_detail *detail)
{ {
detail->flush_time = get_seconds()+1; detail->flush_time = LONG_MAX;
detail->nextcheck = get_seconds(); detail->nextcheck = get_seconds();
cache_flush(); cache_flush();
detail->flush_time = 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment