[PATCH] nfsd: rq_lease_breaker cleanup

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

 



From: J. Bruce Fields <bfields@xxxxxxxxxx>

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@xxxxxxxxxx>
Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
---
 fs/nfsd/nfs4state.c |    3 +++
 fs/nfsd/nfs4xdr.c   |    1 +
 fs/nfsd/nfssvc.c    |    2 --
 3 files changed, 4 insertions(+), 2 deletions(-)

Hey Bruce-

This seems to work a little better than the patch you sent me
this morning.

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 8b08a1ea58fe..8899342f2eb7 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4637,6 +4637,9 @@ static bool nfsd_breaker_owns_lease(struct file_lock *fl)
 	if (!i_am_nfsd())
 		return NULL;
 	rqst = kthread_data(current);
+	/* Note rq_prog == NFS_ACL_PROGRAM is also possible: */
+	if (rqst->rq_prog != NFS_PROGRAM || rqst->rq_vers < 4)
+		return NULL;
 	if (!rqst->rq_lease_breaker)
 		return NULL;
 	clp = *(rqst->rq_lease_breaker);
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 758d8154a5b3..2a374231bd1c 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -5173,6 +5173,7 @@ nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, __be32 *p)
 			__func__, svc_addr(rqstp), be32_to_cpu(rqstp->rq_xid));
 		return 0;
 	}
+	rqstp->rq_lease_breaker = NULL;
 	args->p = p;
 	args->end = rqstp->rq_arg.head[0].iov_base + rqstp->rq_arg.head[0].iov_len;
 	args->pagelist = rqstp->rq_arg.pages;
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index eb07bbd565d7..2117cc70b493 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -1022,8 +1022,6 @@ int nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
 	if (nfs_request_too_big(rqstp, proc))
 		goto out_too_large;
 
-	rqstp->rq_lease_breaker = NULL;
-
 	/*
 	 * Give the xdr decoder a chance to change this if it wants
 	 * (necessary in the NFSv4.0 compound case)





[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