diff options
author | Neil Brown <neilb@suse.com> | 2015-10-16 08:59:08 +1100 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2015-10-23 15:57:30 -0400 |
commit | 778620364ef525e83597a6edee4d0a69db67fd3d (patch) | |
tree | 95efbd21847401270409d5d669ed4b5a0f5721cf /crypto/blowfish_generic.c | |
parent | 825213e59ec24110b0a0f94456db42621f928421 (diff) | |
download | op-kernel-dev-778620364ef525e83597a6edee4d0a69db67fd3d.zip op-kernel-dev-778620364ef525e83597a6edee4d0a69db67fd3d.tar.gz |
sunrpc/cache: make cache flushing more reliable.
The caches used to store sunrpc authentication information can be
flushed by writing a timestamp to a file in /proc.
This timestamp has a one-second resolution and any entry in cache that
was last_refreshed *before* that time is treated as expired.
This is problematic as it is not possible to reliably flush the cache
without interrupting NFS service.
If the current time is written to the "flush" file, any entry that was
added since the current second started will still be treated as valid.
If one second beyond than the current time is written to the file
then no entries can be valid until the second ticks over. This will
mean that no NFS request will be handled for up to 1 second.
To resolve this issue we make two changes:
1/ treat an entry as expired if the timestamp when it was last_refreshed
is before *or the same as* the expiry time. This means that current
code which writes out the current time will now flush the cache
reliably.
2/ when a new entry in added to the cache - set the last_refresh timestamp
to 1 second *beyond* the current flush time, when that not in the
past.
This ensures that newly added entries will always be valid.
Now that we have a very reliable way to flush the cache, and also
since we are using "since-boot" timestamps which are monotonic,
change cache_purge() to set the smallest future flush_time which
will work, and leave it there: don't revert to '1'.
Also disable the setting of the 'flush_time' far into the future.
That has never been useful and is now awkward as it would cause
last_refresh times to be strange.
Finally: if a request is made to set the 'flush_time' to the current
second, assume the intent is to flush the cache and advance it, if
necessary, to 1 second beyond the current 'flush_time' so that all
active entries will be deemed to be expired.
As part of this we need to add a 'cache_detail' arg to cache_init()
and cache_fresh_locked() so they can find the current ->flush_time.
Signed-off-by: NeilBrown <neilb@suse.com>
Reported-by: Olaf Kirch <okir@suse.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'crypto/blowfish_generic.c')
0 files changed, 0 insertions, 0 deletions