HomeFreeBSD

nfsd: Garbage collect stray NFSv4 state

Description

nfsd: Garbage collect stray NFSv4 state

When a file is deleted on the NFS server by another client,
any NFSv4 state related to that file is left stranded.
This happens because the NFSv4 operations that free the
state use a CFH, which is set by a PutFH operation.
However, the PutFH fails with ESTALE because the file has
been deleted.

This patch adds a function called nfsrv_freestrandedstate()
that frees all the NFSv4 state related to a file and calls
this function when PutFH will be replying ESTALE.

While here, a helper function was defined to handle free'ng
of the nfslockfile structure and replaces the two places
where nearly identical code does this.

Reported by: Richard Purdie <richard.purdie@linuxfoundation.org>
Tested by: Michael Halstead <mhalstead@linuxfoundation.org>
MFC after: 2 weeks

Details

Provenance
rmacklemAuthored on Jul 11 2026, 3:49 PM
Parents
rG86691d52a6d3: kvm: Support non-default CPUID leaf
Branches
Unknown
Tags
Unknown