freebsd-dev/sys/fs
Konstantin Belousov e5cffdd34b Do not drop NFS vnode lock when performing consistency checks.
Currently several paths in the NFS client upgrade the shared vnode
lock to exclusive, which might cause temporal dropping of the lock.
This action appears to be fatal for nullfs mounts over NFS. If the
operation is performed over nullfs vnode, then bypassed down to NFS
VOP, and the lock is dropped, other thread might reclaim the upper
nullfs vnode.  Since on reclaim the nullfs vnode lock and NFS vnode
lock are split, the original lock state of the nullfs vnode is not
restored.  As result, VFS operations receive not locked vnode after a
VOP call.

Stop upgrading the vnode lock when we check the consistency or flush
buffers as result of detected inconsistency.  Instead, allocate a new
lockmgr lock for each NFS node, which is locked exclusive instead of
the vnode lock upgrade.  In other words, the other parallel
modification of the vnode are excluded by either vnode lock conflict
or exclusivity of the new lock when the vnode lock is shared.

Also revert r316529 because now the vnode cannot be reclaimed during
ncl_vinvalbuf().

In collaboration with:	pho
Reviewed by:	rmacklem
Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D12083
2017-08-20 10:08:45 +00:00
..
autofs Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
cd9660 Consistently use vop_stdpathconf() for default pathconf values. 2017-07-11 21:55:20 +00:00
cuse Minor code optimisation. 2017-05-31 21:05:24 +00:00
deadfs Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
devfs Commit the 64-bit inode project. 2017-05-23 09:29:05 +00:00
ext2fs Consistently use vop_stdpathconf() for default pathconf values. 2017-07-11 21:55:20 +00:00
fdescfs Implement proper Linux /dev/fd and /proc/self/fd behavior by adding 2017-08-01 03:40:19 +00:00
fifofs Consistently use vop_stdpathconf() for default pathconf values. 2017-07-11 21:55:20 +00:00
fuse Complete support for IO_APPEND flag in fuse 2017-06-28 13:56:15 +00:00
msdosfs Consistently use vop_stdpathconf() for default pathconf values. 2017-07-11 21:55:20 +00:00
nandfs Consistently use vop_stdpathconf() for default pathconf values. 2017-07-11 21:55:20 +00:00
nfs Add kernel support for the NFS client forced dismount "umount -N" option. 2017-07-29 19:52:47 +00:00
nfsclient Do not drop NFS vnode lock when performing consistency checks. 2017-08-20 10:08:45 +00:00
nfsserver Improve FHA locality control for NFS read/write requests. 2017-07-31 15:23:19 +00:00
nullfs Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
procfs remove procfs ctl interface 2017-03-05 03:05:24 +00:00
pseudofs Bump the maximum file name length in pseudofs filesystems to 48. 2017-08-03 21:35:53 +00:00
smbfs Mark pages after EOF as clean after pageout. 2017-07-26 20:07:05 +00:00
tmpfs Consistently use vop_stdpathconf() for default pathconf values. 2017-07-11 21:55:20 +00:00
udf On error, bread(9) zeroes buffer pointer, do not dereference it. 2016-11-22 13:24:57 +00:00
unionfs Renumber copyright clause 4 2017-02-28 23:42:47 +00:00