HomeFreeBSD

nfscl: Fix a deadlock related to the NFSv4 clientID lock

Description

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)

Details

Provenance
rmacklemAuthored on Oct 12 2021, 4:58 AM
Parents
rG589daa05be6f: Revert "libc/locale: Fix races between localeconv(3) and setlocale(3)"
Branches
Unknown
Tags
Unknown