diff mbox series

[7/9] nfsd: remove unused set_clientid argument

Message ID 1611254995-23131-7-git-send-email-bfields@redhat.com (mailing list archive)
State New, archived
Headers show
Series [1/9] nfsd4: simplify process_lookup1 | expand

Commit Message

Bruce Fields Jan. 21, 2021, 6:49 p.m. UTC
From: "J. Bruce Fields" <bfields@redhat.com>

Every caller is setting this argument to false, so we don't need it.

Also clarify comments a little.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 fs/nfsd/nfs4state.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

Comments

Chuck Lever Jan. 21, 2021, 8:20 p.m. UTC | #1
> On Jan 21, 2021, at 1:49 PM, J. Bruce Fields <bfields@redhat.com> wrote:
> 
> From: "J. Bruce Fields" <bfields@redhat.com>
> 
> Every caller is setting this argument to false, so we don't need it.
> 
> Also clarify comments a little.

Some nits:

- The subject says "set_clientid" but the function name is "set_client"

- Is the WARN_ON_ONCE() still needed? (noticed yesterday, but I forgot
to mention it)

- This one doesn't compile:

[cel@klimt linux]$ make C=1 W=1 fs/nfsd/nfs4state.o
make[1]: Entering directory '/home/cel/src/linux/obj/klimt.1015granger.net'
  GEN     Makefile
  UPD     include/config/kernel.release
  UPD     include/generated/utsrelease.h
  CALL    /home/cel/src/linux/linux/scripts/checksyscalls.sh
  CALL    /home/cel/src/linux/linux/scripts/atomic/check-atomics.sh
  DESCEND  objtool
  DESCEND  bpf/resolve_btfids
  CC [M]  fs/nfsd/nfs4state.o
/home/cel/src/linux/linux/fs/nfsd/nfs4state.c: In function ‘nfs4_check_open_reclaim’:
/home/cel/src/linux/linux/fs/nfsd/nfs4state.c:7235:11: error: too many arguments to function ‘set_client’
 7235 |  status = set_client(clid, cstate, nn, false);
      |           ^~~~~~~~~~
/home/cel/src/linux/linux/fs/nfsd/nfs4state.c:4649:15: note: declared here
 4649 | static __be32 set_client(clientid_t *clid,
      |               ^~~~~~~~~~
make[3]: *** [/home/cel/src/linux/linux/scripts/Makefile.build:279: fs/nfsd/nfs4state.o] Error 1
make[2]: *** [/home/cel/src/linux/linux/scripts/Makefile.build:496: fs/nfsd] Error 2
make[1]: *** [/home/cel/src/linux/linux/Makefile:1805: fs] Error 2
make[1]: Leaving directory '/home/cel/src/linux/obj/klimt.1015granger.net'
make: *** [Makefile:185: __sub-make] Error 2
[cel@klimt linux]$

I think I will need a v3 of this series because 8/9 will have to
be fixed up too. Please be sure to add the series version number
when you repost.

Thanks!


> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> ---
> fs/nfsd/nfs4state.c | 22 +++++++++-------------
> 1 file changed, 9 insertions(+), 13 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index db10fef1c1d2..7c95f8808324 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -4648,8 +4648,7 @@ static struct nfs4_client *lookup_clientid(clientid_t *clid, bool sessions,
> 
> static __be32 set_client(clientid_t *clid,
> 		struct nfsd4_compound_state *cstate,
> -		struct nfsd_net *nn,
> -		bool sessions)
> +		struct nfsd_net *nn)
> {
> 	if (cstate->clp) {
> 		if (!same_clid(&cstate->clp->cl_clientid, clid))
> @@ -4658,13 +4657,10 @@ static __be32 set_client(clientid_t *clid,
> 	}
> 	if (STALE_CLIENTID(clid, nn))
> 		return nfserr_stale_clientid;
> -	/*
> -	 * For v4.1+ we get the client in the SEQUENCE op. If we don't have one
> -	 * cached already then we know this is for is for v4.0 and "sessions"
> -	 * will be false.
> -	 */
> +	/* For v4.1+ we should have gotten the client in the SEQUENCE op: */
> 	WARN_ON_ONCE(cstate->session);
> -	cstate->clp = lookup_clientid(clid, sessions, nn);
> +	/* So we're looking for a 4.0 client (sessions = false): */
> +	cstate->clp = lookup_clientid(clid, false, nn);
> 	if (!cstate->clp)
> 		return nfserr_expired;
> 	return nfs_ok;
> @@ -4688,7 +4684,7 @@ nfsd4_process_open1(struct nfsd4_compound_state *cstate,
> 	if (open->op_file == NULL)
> 		return nfserr_jukebox;
> 
> -	status = set_client(clientid, cstate, nn, false);
> +	status = set_client(clientid, cstate, nn);
> 	if (status)
> 		return status;
> 	clp = cstate->clp;
> @@ -5298,7 +5294,7 @@ nfsd4_renew(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> 	struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
> 
> 	trace_nfsd_clid_renew(clid);
> -	status = set_client(clid, cstate, nn, false);
> +	status = set_client(clid, cstate, nn);
> 	if (status)
> 		return status;
> 	clp = cstate->clp;
> @@ -5681,7 +5677,7 @@ nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate,
> 	if (ZERO_STATEID(stateid) || ONE_STATEID(stateid) ||
> 		CLOSE_STATEID(stateid))
> 		return nfserr_bad_stateid;
> -	status = set_client(&stateid->si_opaque.so_clid, cstate, nn, false);
> +	status = set_client(&stateid->si_opaque.so_clid, cstate, nn);
> 	if (status == nfserr_stale_clientid) {
> 		if (cstate->session)
> 			return nfserr_bad_stateid;
> @@ -6905,7 +6901,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> 		 return nfserr_inval;
> 
> 	if (!nfsd4_has_session(cstate)) {
> -		status = set_client(&lockt->lt_clientid, cstate, nn, false);
> +		status = set_client(&lockt->lt_clientid, cstate, nn);
> 		if (status)
> 			goto out;
> 	}
> @@ -7089,7 +7085,7 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp,
> 	dprintk("nfsd4_release_lockowner clientid: (%08x/%08x):\n",
> 		clid->cl_boot, clid->cl_id);
> 
> -	status = set_client(clid, cstate, nn, false);
> +	status = set_client(clid, cstate, nn);
> 	if (status)
> 		return status;
> 
> -- 
> 2.29.2
> 

--
Chuck Lever
Bruce Fields Jan. 21, 2021, 8:42 p.m. UTC | #2
On Thu, Jan 21, 2021 at 08:20:53PM +0000, Chuck Lever wrote:
> 
> 
> > On Jan 21, 2021, at 1:49 PM, J. Bruce Fields <bfields@redhat.com> wrote:
> > 
> > From: "J. Bruce Fields" <bfields@redhat.com>
> > 
> > Every caller is setting this argument to false, so we don't need it.
> > 
> > Also clarify comments a little.
> 
> Some nits:
> 
> - The subject says "set_clientid" but the function name is "set_client"

Thanks, fixed.

> - Is the WARN_ON_ONCE() still needed? (noticed yesterday, but I forgot
> to mention it)

No, I don't think that's an especially interesting case to check for.
I'll drop it.

> 
> - This one doesn't compile:

Oops, thanks, yes, I missed a caller that gets deleted in the next
patch.

> I think I will need a v3 of this series because 8/9 will have to
> be fixed up too. Please be sure to add the series version number
> when you repost.

OK!--b.

> 
> Thanks!
> 
> 
> > Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> > ---
> > fs/nfsd/nfs4state.c | 22 +++++++++-------------
> > 1 file changed, 9 insertions(+), 13 deletions(-)
> > 
> > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> > index db10fef1c1d2..7c95f8808324 100644
> > --- a/fs/nfsd/nfs4state.c
> > +++ b/fs/nfsd/nfs4state.c
> > @@ -4648,8 +4648,7 @@ static struct nfs4_client *lookup_clientid(clientid_t *clid, bool sessions,
> > 
> > static __be32 set_client(clientid_t *clid,
> > 		struct nfsd4_compound_state *cstate,
> > -		struct nfsd_net *nn,
> > -		bool sessions)
> > +		struct nfsd_net *nn)
> > {
> > 	if (cstate->clp) {
> > 		if (!same_clid(&cstate->clp->cl_clientid, clid))
> > @@ -4658,13 +4657,10 @@ static __be32 set_client(clientid_t *clid,
> > 	}
> > 	if (STALE_CLIENTID(clid, nn))
> > 		return nfserr_stale_clientid;
> > -	/*
> > -	 * For v4.1+ we get the client in the SEQUENCE op. If we don't have one
> > -	 * cached already then we know this is for is for v4.0 and "sessions"
> > -	 * will be false.
> > -	 */
> > +	/* For v4.1+ we should have gotten the client in the SEQUENCE op: */
> > 	WARN_ON_ONCE(cstate->session);
> > -	cstate->clp = lookup_clientid(clid, sessions, nn);
> > +	/* So we're looking for a 4.0 client (sessions = false): */
> > +	cstate->clp = lookup_clientid(clid, false, nn);
> > 	if (!cstate->clp)
> > 		return nfserr_expired;
> > 	return nfs_ok;
> > @@ -4688,7 +4684,7 @@ nfsd4_process_open1(struct nfsd4_compound_state *cstate,
> > 	if (open->op_file == NULL)
> > 		return nfserr_jukebox;
> > 
> > -	status = set_client(clientid, cstate, nn, false);
> > +	status = set_client(clientid, cstate, nn);
> > 	if (status)
> > 		return status;
> > 	clp = cstate->clp;
> > @@ -5298,7 +5294,7 @@ nfsd4_renew(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> > 	struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
> > 
> > 	trace_nfsd_clid_renew(clid);
> > -	status = set_client(clid, cstate, nn, false);
> > +	status = set_client(clid, cstate, nn);
> > 	if (status)
> > 		return status;
> > 	clp = cstate->clp;
> > @@ -5681,7 +5677,7 @@ nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate,
> > 	if (ZERO_STATEID(stateid) || ONE_STATEID(stateid) ||
> > 		CLOSE_STATEID(stateid))
> > 		return nfserr_bad_stateid;
> > -	status = set_client(&stateid->si_opaque.so_clid, cstate, nn, false);
> > +	status = set_client(&stateid->si_opaque.so_clid, cstate, nn);
> > 	if (status == nfserr_stale_clientid) {
> > 		if (cstate->session)
> > 			return nfserr_bad_stateid;
> > @@ -6905,7 +6901,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> > 		 return nfserr_inval;
> > 
> > 	if (!nfsd4_has_session(cstate)) {
> > -		status = set_client(&lockt->lt_clientid, cstate, nn, false);
> > +		status = set_client(&lockt->lt_clientid, cstate, nn);
> > 		if (status)
> > 			goto out;
> > 	}
> > @@ -7089,7 +7085,7 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp,
> > 	dprintk("nfsd4_release_lockowner clientid: (%08x/%08x):\n",
> > 		clid->cl_boot, clid->cl_id);
> > 
> > -	status = set_client(clid, cstate, nn, false);
> > +	status = set_client(clid, cstate, nn);
> > 	if (status)
> > 		return status;
> > 
> > -- 
> > 2.29.2
> > 
> 
> --
> Chuck Lever
> 
> 
>
diff mbox series

Patch

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index db10fef1c1d2..7c95f8808324 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4648,8 +4648,7 @@  static struct nfs4_client *lookup_clientid(clientid_t *clid, bool sessions,
 
 static __be32 set_client(clientid_t *clid,
 		struct nfsd4_compound_state *cstate,
-		struct nfsd_net *nn,
-		bool sessions)
+		struct nfsd_net *nn)
 {
 	if (cstate->clp) {
 		if (!same_clid(&cstate->clp->cl_clientid, clid))
@@ -4658,13 +4657,10 @@  static __be32 set_client(clientid_t *clid,
 	}
 	if (STALE_CLIENTID(clid, nn))
 		return nfserr_stale_clientid;
-	/*
-	 * For v4.1+ we get the client in the SEQUENCE op. If we don't have one
-	 * cached already then we know this is for is for v4.0 and "sessions"
-	 * will be false.
-	 */
+	/* For v4.1+ we should have gotten the client in the SEQUENCE op: */
 	WARN_ON_ONCE(cstate->session);
-	cstate->clp = lookup_clientid(clid, sessions, nn);
+	/* So we're looking for a 4.0 client (sessions = false): */
+	cstate->clp = lookup_clientid(clid, false, nn);
 	if (!cstate->clp)
 		return nfserr_expired;
 	return nfs_ok;
@@ -4688,7 +4684,7 @@  nfsd4_process_open1(struct nfsd4_compound_state *cstate,
 	if (open->op_file == NULL)
 		return nfserr_jukebox;
 
-	status = set_client(clientid, cstate, nn, false);
+	status = set_client(clientid, cstate, nn);
 	if (status)
 		return status;
 	clp = cstate->clp;
@@ -5298,7 +5294,7 @@  nfsd4_renew(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 	struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
 
 	trace_nfsd_clid_renew(clid);
-	status = set_client(clid, cstate, nn, false);
+	status = set_client(clid, cstate, nn);
 	if (status)
 		return status;
 	clp = cstate->clp;
@@ -5681,7 +5677,7 @@  nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate,
 	if (ZERO_STATEID(stateid) || ONE_STATEID(stateid) ||
 		CLOSE_STATEID(stateid))
 		return nfserr_bad_stateid;
-	status = set_client(&stateid->si_opaque.so_clid, cstate, nn, false);
+	status = set_client(&stateid->si_opaque.so_clid, cstate, nn);
 	if (status == nfserr_stale_clientid) {
 		if (cstate->session)
 			return nfserr_bad_stateid;
@@ -6905,7 +6901,7 @@  nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 		 return nfserr_inval;
 
 	if (!nfsd4_has_session(cstate)) {
-		status = set_client(&lockt->lt_clientid, cstate, nn, false);
+		status = set_client(&lockt->lt_clientid, cstate, nn);
 		if (status)
 			goto out;
 	}
@@ -7089,7 +7085,7 @@  nfsd4_release_lockowner(struct svc_rqst *rqstp,
 	dprintk("nfsd4_release_lockowner clientid: (%08x/%08x):\n",
 		clid->cl_boot, clid->cl_id);
 
-	status = set_client(clid, cstate, nn, false);
+	status = set_client(clid, cstate, nn);
 	if (status)
 		return status;