[PATCH 7/9] NFSD: Correct locking documentation for delegation sc_status
Chuck Lever <[email protected]> Sun, 02 Aug 2026 13:04:34 -0400
| Newsgroups | org.kernel.vger.linux-nfs |
|---|---|
| Message-ID | <20260802-nfsd-deleg-destroy-badhandle-v1-7-323aa7196055@kernel.org> |
The comment above the SC_STATUS_ flags states that nn->deleg_lock
protects sc_status for delegation stateids, but only the transitions
made while a delegation is hashed are taken under that lock. This
comment was accurate until commit c88c150a467f ("nfsd: fix possible
badness in FREE_STATEID") set SC_STATUS_CLOSED under ->cl_lock.
Commit 8dd91e8d31fe ("nfsd: fix race between laundromat and
free_stateid") added the other two sites.
Signed-off-by: Chuck Lever <[email protected]>
---
fs/nfsd/state.h | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index c4627dc91e20..42d3320622eb 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -145,10 +145,13 @@ struct nfs4_stid {
#define SC_TYPE_COPY BIT(4)
unsigned short sc_type;
-/* nn->deleg_lock protects sc_status for delegation stateids.
- * ->cl_lock protects sc_status for open and lock stateids.
- * ->st_mutex also protect sc_status for open stateids.
- * ->ls_lock protects sc_status for layout stateids.
+/*
+ * nn->deleg_lock protects sc_status for hashed delegation stateids.
+ * ->cl_lock protects the bits set as one is disposed of
+ * (SC_STATUS_CLOSED, SC_STATUS_FREEABLE, SC_STATUS_FREED) and
+ * sc_status for open and lock stateids. ->st_mutex also protects
+ * sc_status for open stateids. ->ls_lock protects sc_status for
+ * layout stateids.
*/
/*
* For an open stateid kept around *only* to process close replays.
--
2.54.0