]> 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, 12 Oct 2021 04:58:24 +0000 (21:58 -0700)
commit120b20bdf49630cf2a7dbc5f93b9e985e1f4f198
tree591a29772641cdc3fe30170a0c54c408cb868237
parent2d827c065a1c6ed12d48fc71ab41443e2de0936f
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.

MFC after: 1 week
sys/fs/nfs/nfs_var.h
sys/fs/nfsclient/nfs_clrpcops.c
sys/fs/nfsclient/nfs_clstate.c
sys/fs/nfsclient/nfs_clvfsops.c