HomeFreeBSD

nfsd: Fix close handling when vfs.nfsd.enable_locallocks=1

Description

nfsd: Fix close handling when vfs.nfsd.enable_locallocks=1

nfsrv_freeopen() was being called after the mutex
lock was released, making it possible for other
kernel threads to change the lists while nfsrv_freeopen()
took the nfsstateid out of the lists.

This patch moves the code around
"if (nfsrv_freeopen(stp, vp, 1 p) == 0) {"
into nfsrv_freeopen(), so that it can remove the nfsstateid
structure from all lists before unlocking the mutex.
This should avoid any race between CLOSE and other nfsd threads
updating the NFSv4 state.

The patch does not affect semantics when vfs.nfsd.enable_locallocks=0.

PR: 280978
Tested by: Matthew L. Dailey <matthew.l.dailey@dartmouth.edu>

(cherry picked from commit eb345e05ac6602eeef0c33fce9025bbc8ec44d0f)

Details

Provenance
rmacklemAuthored on Sep 30 2024, 10:49 PM
Parents
rG7e229794ca37: uncompress: Avoid reading an extra byte
Branches
Unknown
Tags
Unknown