nfsd: convert global state_lock to per-net deleg_lock
Subsystems (2)
Jeff Layton
maintainerPATCH 1/1 nfsd: convert global state_lock to per-net deleg_lock
Replace the global state_lock spinlock with a per-nfsd_net deleg_lock. The state_lock was only used to protect delegation lifecycle operations (the del_recall_lru list and delegation hash/unhash), all of which are scoped to a single network namespace. Making the lock per-net removes a source of unnecessary contention between containers.
--- fs/nfsd/netns.h | 3 +++ fs/nfsd/nfs4state.c | 62 +++++++++++++++++++++++++++-------------------------- fs/nfsd/state.h | 2 +- 3 files changed, 36 insertions(+), 31 deletions(-)
fs/nfsd/netns.h +3 -0
@@ -101,6 +101,9 @@ struct nfsd_net {struct list_head close_lru;struct list_head del_recall_lru; +/* protects del_recall_lru and delegation hash/unhash */ +spinlock_t deleg_lock; +/* protected by blocked_locks_lock */ struct list_head blocked_locks_lru;
fs/nfsd/nfs4state.c +32 -30
214 lines not on this page · raw message
fs/nfsd/state.h +1 -1
@@ -123,7 +123,7 @@ struct nfs4_stid {#define SC_TYPE_LAYOUT BIT(3)unsigned short sc_type; -/* state_lock protects sc_status for delegation stateids. +/* 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.
---
base-commit: 9affc4c96f49744c7eab647d922fc82d290834b2
change-id: 20260224-nfsd-deleg-lock-45d00443c33d
Best regards,
Signature · 1 line
Jeff Layton <[email protected]>
Chuck Lever
maintainerFrom: Chuck Lever <[email protected]>
Quoted 8 lines · Jeff Layton
Replace the global
state_lockspinlock with a per-nfsd_netdeleg_lock. Thestate_lockwas only used to protect delegation lifecycle operations (thedel_recall_lrulist and delegation hash/unhash), all of which are scoped to a single network namespace. Making the lock per-net removes a source of unnecessary contention between containers.[...]
Applied to nfsd-testing with minor changes, thanks!
[1/1] nfsd: convert global state_lock to per-net deleg_lock
commit: 87d8659010fe5ba78759ad7b8780656f1c3d350a
--
Chuck Lever