Re: [RFC PATCH 1/3] NFSD: Record call's slot index

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2025-02-14 at 10:57 -0500, cel@xxxxxxxxxx wrote:
> From: Chuck Lever <chuck.lever@xxxxxxxxxx>
> 
> The slot index number of the current COMPOUND has, until now, not
> been needed outside of nfsd4_sequence(). But to record the tuple
> that represents the referring call, the slot number will be
> needed when processing subsequent operations in the COMPOUND.
> 
> I've brute-forced this by adding a field to nfsd4_compound_state,
> but there's probably a way to add the index to nfsd4_slot. I'm just
> not sure yet whether slot table resizing might change the index that
> a struct nfsd4_slot represents.
> 

The slot number is just the index into the xarray, and AFAICS they
never change indexes. I think it's safe to just store the index in the
nfsd4_slot itself whenever an xa_store is done in se_slots.

> Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
> ---
>  fs/nfsd/nfs4proc.c  | 1 +
>  fs/nfsd/nfs4state.c | 1 +
>  fs/nfsd/xdr4.h      | 1 +
>  3 files changed, 3 insertions(+)
> 
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index 23052fa0e8bf..d09a96cbec1e 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -2792,6 +2792,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp)
>  
>  	resp->xdr = &rqstp->rq_res_stream;
>  	resp->statusp = resp->xdr->p;
> +	cstate->slot_idx = -1;
>  
>  	/* reserve space for: NFS status code */
>  	xdr_reserve_space(resp->xdr, XDR_UNIT);
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index b7a0cfd05401..c38601c9bf13 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -4415,6 +4415,7 @@ nfsd4_sequence(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
>  	else
>  		slot->sl_flags &= ~NFSD4_SLOT_CACHETHIS;
>  
> +	cstate->slot_idx = seq->slotid;
>  	cstate->slot = slot;
>  	cstate->session = session;
>  	cstate->clp = clp;
> diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
> index c26ba86dbdfd..561894ff4b01 100644
> --- a/fs/nfsd/xdr4.h
> +++ b/fs/nfsd/xdr4.h
> @@ -186,6 +186,7 @@ struct nfsd4_compound_state {
>  	/* For sessions DRC */
>  	struct nfsd4_session	*session;
>  	struct nfsd4_slot	*slot;
> +	int			slot_idx;
>  	int			data_offset;
>  	bool                    spo_must_allowed;
>  	size_t			iovlen;

-- 
Jeff Layton <jlayton@xxxxxxxxxx>





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux