[PATCH 3/4] NFSD: Name directory delegations in the CB_RECALL_ANY type mask

Chuck Lever <[email protected]>
Newsgroups gmane.linux.nfs
Message-ID <[email protected]>
RFC 8881 Section 20.6.3 has craa_type_mask name the types of
recallable object in the resource pool that is over-utilized. The
section distinguishes a server that shares one pool among all
classes from one that keeps separate pools per class. NFSD shares
one. nfsd_get_dir_deleg() allocates through __alloc_init_deleg(), the
same helper the file delegation path uses. A directory delegation comes
from the same slab and is charged against the same num_delegations and
max_delegations budget. The state shrinker counts it.

deleg_reaper() nevertheless names only RCA4_TYPE_MASK_RDATA_DLG and
RCA4_TYPE_MASK_WDATA_DLG, describing a resource pool NFSD does not
have. Add RCA4_TYPE_MASK_DIR_DLG.

A client that implements directory delegations will start returning
them on a callback that never named them before. NFSD takes that
return on the path it already takes for any other: nfsd4_delegreturn()
resolves the stateid as SC_TYPE_DELEG and calls destroy_delegation()
with no branch on what the delegation covers.

Signed-off-by: Chuck Lever <[email protected]>
---
 fs/nfsd/nfs4state.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 2ddc77ac7312..3017a93261ff 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -7969,7 +7969,8 @@ deleg_reaper(struct nfsd_net *nn)
 		clp->cl_ra_time = ktime_get_boottime_seconds();
 		clp->cl_ra->ra_keep = 0;
 		clp->cl_ra->ra_bmval[0] = BIT(RCA4_TYPE_MASK_RDATA_DLG) |
-						BIT(RCA4_TYPE_MASK_WDATA_DLG);
+						BIT(RCA4_TYPE_MASK_WDATA_DLG) |
+						BIT(RCA4_TYPE_MASK_DIR_DLG);
 		trace_nfsd_cb_recall_any(clp->cl_ra);
 		nfsd4_run_cb(&clp->cl_ra->ra_cb);
 	}

-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.