]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
nfscl: Fix a deadlock related to the NFSv4 clientID lock
authorRick Macklem <rmacklem@FreeBSD.org>
Tue, 12 Oct 2021 04:58:24 +0000 (21:58 -0700)
committerRick Macklem <rmacklem@FreeBSD.org>
Tue, 19 Oct 2021 03:31:47 +0000 (20:31 -0700)
commit16f3a89d08b2deffccace6f605a9e9883cfbd4e2
tree58818f47fed20b563dbb88e2ad7d2f3dcbab40b6
parent35f1d655819e5d4d11ea1a11061f80e48e35f173
nfscl: Fix a deadlock related to the NFSv4 clientID lock

Without this patch, it is possible for a process doing an NFSv4
Open/create of a file to block to allow another process
to acquire the exclusive lock on the clientID when holding
a shared lock on the clientID.  As such, both processes
deadlock, with one wanting the exclusive lock, while the
other holds the shared lock.  This deadlock is unlikely to occur
unless delegations are in use on the NFSv4 mount.

This patch fixes the problem by not deferring to the process
waiting for the exclusive lock when a shared lock (reference cnt)
is already held by the process.

This problem was detected during a recent NFSv4 interoperability
testing event held by the IETF working group.

(cherry picked from commit 120b20bdf49630cf2a7dbc5f93b9e985e1f4f198)
sys/fs/nfs/nfs_var.h
sys/fs/nfsclient/nfs_clrpcops.c
sys/fs/nfsclient/nfs_clstate.c
sys/fs/nfsclient/nfs_clvfsops.c