Skip to content

RFC state lock reduction prep

Benny Halevy linux-nfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest11 patches 12 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11nfsd: introduce nfs4_client statefs/nfsd/state.h+8 -02 replies
2/11nfsd: mark client state as expired in expire_clientfs/nfsd/nfs4state.c+1 -00 replies
3/11nfsd: introduce get_nfs4_clientfs/nfsd/nfs4callback.c fs/nfsd/nfs4state.c fs/nfsd/state.h+8 -10 replies
4/11nfsd: mark client for renewfs/nfsd/nfs4proc.c fs/nfsd/nfs4state.c fs/nfsd/state.h +1 more+42 -46 replies
5/11nfsd: skip clients marked for renewalfs/nfsd/nfs4state.c+3 -02 replies
6/11nfsd41: no need to hold the state lock around mark_client_for_renewfs/nfsd/nfs4state.c+1 -40 replies
7/11nfsd: rename recall_lock to deleg_lockfs/nfsd/nfs4state.c+18 -180 replies
8/11nfsd: use deleg_lock to protect dl_perfile and dl_perclntfs/nfsd/nfs4state.c+8 -40 replies
9/11nfsd: get a reference count on the delgation while outside of the deleg_lockfs/nfsd/nfs4state.c+7 -10 replies
10/11nfsd: close delegation only on last referencefs/nfsd/nfs4state.c+13 -142 replies
11/11nfsd: refactor unhash_delegationfs/nfsd/nfs4state.c+13 -70 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC 0/11] state lock reduction prep

Bruce,

The following patches implement the first phase in preparation for reducing the scope in we which we hold the state lock mutex.

[RFC 01/11] nfsd: introduce nfs4_client state
[RFC 02/11] nfsd: mark client state as expired in expire_client [RFC 03/11] nfsd: introduce get_nfs4_client
[RFC 04/11] nfsd: mark client for renew
[RFC 05/11] nfsd: skip clients marked for renewal
[RFC 06/11] nfsd41: no need to hold the state lock around mark_client_for_renew

the patches above use an atomic cl_state field to manage the nfs4_client expire vs. renew state so this can be done outside the state lock.

[RFC 07/11] nfsd: rename recall_lock to deleg_lock
[RFC 08/11] nfsd: use deleg_lock to protect dl_perfile and dl_perclnt
[RFC 09/11] nfsd: get a reference count on the delgation while outside of the deleg_lock [RFC 10/11] nfsd: close delegation only on last reference
[RFC 11/11] nfsd: refactor unhash_delegation

The patches above augment the use of the recall_lock spinlock (and rename it to deleg_lock) and grab a reference count on the delegation structure while not protected by the deleg_lock. The delegation's respective file will be closed only on last dereference, so the deleg structure could be used safely while not holding the state_lock and potentially in parallel to expire_client being called (and unhashing the delegation)

The next steps I see are:

1. use a spinlock for traversing the nfs4_client hash lists
2. use a spinlock for traversing the nfs4_stateowner lists

Eventually, reducing the state_lock scope for complex state changes requiring the coordination of state across multiple lists and involving blocking ops (e.g. allocation, manipulating clid_dir) in particular there should be no need to hold the state lock for expire_client.

Benny