linux/net/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
..
auth_gss sunrpc: avoid warning in gss_key_timeout 2015-10-23 15:57:28 -04:00
xprtrdma svcrdma: Fix NFS server crash triggered by 1MB NFS WRITE 2015-10-12 11:55:43 -04:00
addr.c replace strict_strto calls 2014-07-12 18:45:49 -04:00
auth.c kernel/params: constify struct kernel_param_ops uses 2015-05-28 11:32:10 +09:30
auth_generic.c sunrpc: eliminate RPC_DEBUG 2014-11-24 17:31:46 -05:00
auth_null.c sunrpc: eliminate RPC_DEBUG 2014-11-24 17:31:46 -05:00
auth_unix.c sunrpc: increase UNX_MAXNODENAME from 32 to __NEW_UTS_LEN bytes 2015-08-12 14:31:04 -04:00
backchannel_rqst.c SUNRPC: xprt_complete_bc_request must also decrement the free slot count 2015-07-22 17:10:50 -04:00
cache.c sunrpc/cache: make cache flushing more reliable. 2015-10-23 15:57:30 -04:00
clnt.c SUNRPC: Don't reencode message if transmission failed with ENOBUFS 2015-07-03 09:42:12 -04:00
debugfs.c SUNRPC: Address kbuild warning in net/sunrpc/debugfs.c 2015-06-11 14:01:06 -04:00
Kconfig rpcrdma: Merge svcrdma and xprtrdma modules into one 2015-06-04 16:56:02 -04:00
Makefile NFS client updates for Linux 4.2 2015-07-02 11:32:23 -07:00
netns.h Merge branch 'for-3.14' of git://linux-nfs.org/~bfields/linux 2014-01-30 10:18:43 -08:00
rpc_pipe.c VFS: net/: d_inode() annotations 2015-04-15 15:06:56 -04:00
rpcb_clnt.c SUNRPC: NULL utsname dereference on NFS umount during namespace cleanup 2015-02-03 16:40:17 -05:00
sched.c NFS client bugfixes for Linux 4.3 2015-09-25 11:33:52 -07:00
socklib.c net: Save software checksum complete 2014-06-11 15:46:13 -07:00
stats.c sunrpc: add rpc_count_iostats_idx 2015-02-03 11:06:38 -08:00
sunrpc.h SUNRPC: track whether a request is coming from a loop-back interface. 2014-05-22 15:59:18 -04:00
sunrpc_syms.c sunrpc: make debugfs file creation failure non-fatal 2015-04-23 14:42:27 -04:00
svc.c nfsd/sunrpc: factor svc_rqst allocation and freeing from sv_nrthreads refcounting 2015-08-10 16:05:44 -04:00
svc_xprt.c nfsd/sunrpc: turn enqueueing a svc_xprt into a svc_serv operation 2015-08-10 16:05:42 -04:00
svcauth.c nfsd4: better reservation of head space for krb5 2014-05-30 17:32:17 -04:00
svcauth_unix.c svcrpc: fix failures to handle -1 uid's 2013-07-08 17:27:23 -04:00
svcsock.c SUNRPC: Use MSG_SENDPAGE_NOTLAST when calling sendpage() 2015-10-23 15:57:27 -04:00
sysctl.c sunrpc: eliminate RPC_DEBUG 2014-11-24 17:31:46 -05:00
timer.c net: cleanup unsigned to unsigned int 2012-04-15 12:44:40 -04:00
xdr.c rpc: fix xdr_truncate_encode to handle buffer ending on page boundary 2015-01-07 14:03:58 -05:00
xprt.c SUNRPC: Lock the transport layer on shutdown 2015-09-19 16:37:43 -04:00
xprtsock.c SUNRPC: Use MSG_SENDPAGE_NOTLAST when calling sendpage() 2015-10-23 15:57:27 -04:00