linux-uconsole/include/linux/sunrpc
Neil Brown 778620364e 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>
2015-10-23 15:57:30 -04:00
..
addr.h SUNRPC: Drop double-underscores from __rpc_cmp_addr6() 2015-08-17 14:47:53 -05:00
auth.h sunrpc: increase UNX_MAXNODENAME from 32 to __NEW_UTS_LEN bytes 2015-08-12 14:31:04 -04:00
auth_gss.h sunrpc: remove __rcu annotation from struct gss_cl_ctx->gc_gss_ctx 2014-08-03 17:05:23 -04:00
bc_xprt.h SUNRPC: Clean up bc_send() 2015-06-02 13:30:35 -04:00
cache.h sunrpc/cache: make cache flushing more reliable. 2015-10-23 15:57:30 -04:00
clnt.h sunrpc: keep a count of swapfiles associated with the rpc_clnt 2015-06-10 18:26:14 -04:00
debug.h sunrpc: make debugfs file creation failure non-fatal 2015-04-23 14:42:27 -04:00
gss_api.h
gss_asn1.h
gss_err.h
gss_krb5.h sunrpc: remove "ec" argument from encrypt_v2 operation 2014-08-03 17:05:24 -04:00
gss_krb5_enctypes.h
metrics.h SUNRPC: Fix a compile error when #undef CONFIG_PROC_FS 2015-02-12 08:31:38 -05:00
msg_prot.h SUNRPC: Introduce missing well-known netids 2015-03-31 09:52:52 -04:00
rpc_pipe_fs.h
rpc_rdma.h xprtrdma: Clean up hdrlen 2015-01-30 10:47:48 -05:00
sched.h sunrpc: keep a count of swapfiles associated with the rpc_clnt 2015-06-10 18:26:14 -04:00
stats.h
svc.h nfsd/sunrpc: factor svc_rqst allocation and freeing from sv_nrthreads refcounting 2015-08-10 16:05:44 -04:00
svc_rdma.h Changes for 4.3 2015-09-09 08:33:31 -07:00
svc_xprt.h nfsd/sunrpc: turn enqueueing a svc_xprt into a svc_serv operation 2015-08-10 16:05:42 -04:00
svcauth.h
svcauth_gss.h
svcsock.h
timer.h
types.h
xdr.h
xprt.h SUNRPC: Transport fault injection 2015-06-10 18:37:26 -04:00
xprtrdma.h xprtrdma: Increase default credit limit 2015-08-05 16:21:26 -04:00
xprtsock.h SUNRPC: Ensure that we wait for connections to complete before retrying 2015-09-17 18:01:28 -04:00