diff mbox series

[1/9] nfsd: rq_lease_breaker cleanup

Message ID 160105319858.19706.8351588171501305958.stgit@klimt.1015granger.net (mailing list archive)
State New, archived
Headers show
Series nfsd_dispatch() clean up | expand

Commit Message

Chuck Lever Sept. 25, 2020, 4:59 p.m. UTC
From: J. Bruce Fields <bfields@redhat.com>

Since only the v4 code cares about it, maybe it's better to leave
rq_lease_breaker out of the common dispatch code?

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/nfs4state.c |    3 +++
 fs/nfsd/nfssvc.c    |    1 -
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

Chuck Lever Sept. 25, 2020, 5:30 p.m. UTC | #1
> On Sep 25, 2020, at 12:59 PM, Chuck Lever <chuck.lever@oracle.com> wrote:
> 
> From: J. Bruce Fields <bfields@redhat.com>
> 
> Since only the v4 code cares about it, maybe it's better to leave
> rq_lease_breaker out of the common dispatch code?
> 
> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
> fs/nfsd/nfs4state.c |    3 +++
> fs/nfsd/nfssvc.c    |    1 -
> 2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index c09a2a4281ec..d9325dea0b74 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -4596,6 +4596,9 @@ static bool nfsd_breaker_owns_lease(struct file_lock *fl)
> 
> 	if (!i_am_nfsd())
> 		return NULL;
> +	/* Note rq_prog == NFS_ACL_PROGRAM is also possible: */
> +	if (rqst->rq_prog != NFS_PROGRAM || rqst->rq_vers < 4)
> +		return NULL;
> 	rqst = kthread_data(current);

I had to apply this one by hand, and as usual, got it wrong.


> 	if (!rqst->rq_lease_breaker)
> 		return NULL;
> diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
> index f7f6473578af..f6bc94cab9da 100644
> --- a/fs/nfsd/nfssvc.c
> +++ b/fs/nfsd/nfssvc.c
> @@ -1016,7 +1016,6 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
> 		*statp = rpc_garbage_args;
> 		return 1;
> 	}
> -	rqstp->rq_lease_breaker = NULL;
> 	/*
> 	 * Give the xdr decoder a chance to change this if it wants
> 	 * (necessary in the NFSv4.0 compound case)
> 
> 

--
Chuck Lever
diff mbox series

Patch

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index c09a2a4281ec..d9325dea0b74 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4596,6 +4596,9 @@  static bool nfsd_breaker_owns_lease(struct file_lock *fl)
 
 	if (!i_am_nfsd())
 		return NULL;
+	/* Note rq_prog == NFS_ACL_PROGRAM is also possible: */
+	if (rqst->rq_prog != NFS_PROGRAM || rqst->rq_vers < 4)
+		return NULL;
 	rqst = kthread_data(current);
 	if (!rqst->rq_lease_breaker)
 		return NULL;
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index f7f6473578af..f6bc94cab9da 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -1016,7 +1016,6 @@  nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
 		*statp = rpc_garbage_args;
 		return 1;
 	}
-	rqstp->rq_lease_breaker = NULL;
 	/*
 	 * Give the xdr decoder a chance to change this if it wants
 	 * (necessary in the NFSv4.0 compound case)