freebsd-nq/sys
Rick Macklem b2fc0141d9 Fix NFSv4.1 client recovery from NFS4ERR_BAD_SESSION errors.
For most NFSv4.1 servers, a NFS4ERR_BAD_SESSION error is a rare failure
that indicates that the server has lost session/open/lock state.
However, recent testing by cperciva@ against the AmazonEFS server found
several problems with client recovery from this due to it generating this
failure frequently.
Briefly, the problems fixed are:
- If all session slots were in use at the time of the failure, some processes
  would continue to loop waiting for a slot on the old session forever.
- If an RPC that doesn't use open/lock state failed with NFS4ERR_BAD_SESSION,
  it would fail the RPC/syscall instead of initiating recovery and then
  looping to retry the RPC.
- If a successful reply to an RPC for an old session wasn't processed
  until after a new session was created for a NFS4ERR_BAD_SESSION error,
  it would erroneously update the new session and corrupt it.
- The use of the first element of the session list in the nfs mount
  structure (which is always the current metadata session) was slightly
  racey. With changes for the above problems it became more racey, so all
  uses of this head pointer was wrapped with a NFSLOCKMNT()/NFSUNLOCKMNT().
- Although the kernel malloc() usually allocates more bytes than requested
  and, as such, this wouldn't have caused problems, the allocation of a
  session structure was 1 byte smaller than it should have been.
  (Null termination byte for the string not included in byte count.)

There are probably still problems with a pNFS data server that fails
with NFS4ERR_BAD_SESSION, but I have no server that does this to test
against (the AmazonEFS server doesn't do pNFS), so I can't fix these yet.

Although this patch is fairly large, it should only affect the handling
of NFS4ERR_BAD_SESSION error replies from an NFSv4.1 server.
Thanks go to cperciva@ for the extension testing he did to help isolate/fix
these problems.

Reported by:	cperciva
Tested by:	cperciva
MFC after:	3 months
Differential Revision:	https://reviews.freebsd.org/D8745
2016-12-23 23:14:53 +00:00
..
amd64 Fix typo. Remove spurious blank line. 2016-12-18 09:32:23 +00:00
arm Allwinner clk: factor M for mod clock is 4 bits, not 5 2016-12-22 15:01:06 +00:00
arm64 Add virtio_pci to GENERIC arm64 conf 2016-12-18 11:15:31 +00:00
boot Add a dumpdev example to /boot/defaults/loader.conf 2016-12-22 15:48:54 +00:00
bsm
cam Implement printing forwarded sense data. 2016-12-23 21:56:08 +00:00
cddl Remove extra DOF_SEC_XLIMPORT from the DOF_SEC_ISLOADABLE macro 2016-12-16 20:44:14 +00:00
compat linuxkpi: Fix not-found case of linux_pci_find_irq_dev 2016-12-13 19:58:21 +00:00
conf Use ${.OBJDIR} to refer to the kernel build object dir, instead of trying 2016-12-22 21:11:42 +00:00
contrib Add a FREEBSD-Xlist file for CK. 2016-11-28 21:16:03 +00:00
crypto Add accelerated AES with using the ARMv8 crypto instructions. This is based 2016-11-21 11:18:00 +00:00
ddb Use casts to force an unsigned comparison in db_search_symbol(). 2016-12-14 00:18:12 +00:00
dev mlx(4): remove date from log message 2016-12-23 20:14:05 +00:00
fs Fix NFSv4.1 client recovery from NFS4ERR_BAD_SESSION errors. 2016-12-23 23:14:53 +00:00
gdb
geom build: Unbreak LINT 2016-12-21 01:39:11 +00:00
gnu Add Ingenic X1000 DTS files (unofficial). 2016-11-19 15:03:49 +00:00
i386 Move the objects used to create temporary mappings for i386 pmap zero and copy 2016-12-23 15:14:56 +00:00
isa
kern Add a comment explaining the race fixed by r310423. 2016-12-23 05:02:17 +00:00
kgssapi
libkern Update r309143 to prevent false sharing. 2016-11-25 17:20:23 +00:00
mips Pass memattrs to fb device so that user mappings can inherit them 2016-12-23 19:30:14 +00:00
modules hyperv/ic: Rename cleaned up files. 2016-12-20 09:46:14 +00:00
net Remove stray debugging code from r310180 2016-12-20 15:45:53 +00:00
net80211 [net80211] WEP offload support. 2016-12-22 23:59:53 +00:00
netgraph Changes to allow the patching of packets with an offset (and other changes.. see man page) 2016-12-02 10:47:10 +00:00
netinet Remove assigned only variable. 2016-12-21 22:47:10 +00:00
netinet6 Remove a bogus KASSERT from nd6_prefix_unlink(). 2016-12-19 19:21:28 +00:00
netipsec Add a missing header 2016-11-26 23:15:11 +00:00
netnatm
netpfil Improve upon r309394 2016-12-10 03:31:38 +00:00
netsmb
nfs
nfsclient
nfsserver
nlm
ofed Move the ConnectX-3 and ConnectX-2 driver from sys/ofed into sys/dev/mlx4 2016-09-30 08:23:06 +00:00
opencrypto Add support for the fpu_kern(9) KPI on arm64. It hooks into the existing 2016-10-20 09:22:10 +00:00
pc98 Add a COMPAT_FREEBSD11 kernel option. 2016-12-09 18:54:12 +00:00
powerpc Fix disassembly by adding back some deleted lines. 2016-12-16 04:47:29 +00:00
riscv Disable superpages reservations as we don't have implemented them yet. 2016-11-21 12:00:31 +00:00
rpc
security Audit 'fd' and 'cmd' arguments to fcntl(2), and when generating BSM, 2016-11-22 00:41:24 +00:00
sparc64 Add support for encrypted kernel crash dumps. 2016-12-10 16:20:39 +00:00
sys hyperv: Implement userspace gettimeofday(2) with Hyper-V reference TSC 2016-12-19 07:40:45 +00:00
teken
tests
tools Consider CROSS_BINUTILS_PREFIX environment variable so we use correct 2016-08-10 13:49:17 +00:00
ufs Release laundered vnode pages to the head of the inactive queue. 2016-11-23 17:53:07 +00:00
vm Improve vm_object_scan_all_shadowed() to also check swap backing objects. 2016-12-18 20:56:14 +00:00
x86 xen: fix IPI setup with EARLY_AP_STARTUP 2016-12-22 16:09:44 +00:00
xdr
xen xen: fix IPI setup with EARLY_AP_STARTUP 2016-12-22 16:09:44 +00:00
Makefile