]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix NFS client deadlock when read reports truncated node.
authorkib <kib@FreeBSD.org>
Sat, 22 Feb 2020 20:50:30 +0000 (20:50 +0000)
committerkib <kib@FreeBSD.org>
Sat, 22 Feb 2020 20:50:30 +0000 (20:50 +0000)
commit85bc84ae6593db9e3f8b89c54de2528de434c32c
tree9ade0faeb4aee4a4c3118471e4af6dc46c9f418f
parent7eccf9b9717542cef4ccb4e1d5cf68f538b455f2
Fix NFS client deadlock when read reports truncated node.

If node attribute returned in the reply for read rpc indicate
truncation, and it happens that the vnode is exclusively locked,
update of the node attributes would try to shrink vnode size.  Since
during the read some vnode pages were busied by the reading thread,
vnode_pager_setsize() deadlocks waiting for the busy state owned by
the caller.

Use a thread-local flag to indicate that NFS read owns some (s)busy
pages states and postpone the call to vnode_pager_setsize() until the
thread relinguishes the ownership.

Diagnosed by: rlibby
Tested by: pho, rlibby
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
sys/fs/nfsclient/nfs_clbio.c
sys/fs/nfsclient/nfs_clport.c
sys/sys/proc.h