* [PATCH] nfsd: rq_lease_breaker cleanup
@ 2020-09-25 19:03 Chuck Lever
2020-09-25 20:48 ` J. Bruce Fields
0 siblings, 1 reply; 4+ messages in thread
From: Chuck Lever @ 2020-09-25 19:03 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs
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/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)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] nfsd: rq_lease_breaker cleanup
2020-09-25 19:03 [PATCH] nfsd: rq_lease_breaker cleanup Chuck Lever
@ 2020-09-25 20:48 ` J. Bruce Fields
2020-09-25 20:49 ` Chuck Lever
0 siblings, 1 reply; 4+ messages in thread
From: J. Bruce Fields @ 2020-09-25 20:48 UTC (permalink / raw)
To: Chuck Lever; +Cc: linux-nfs
On Fri, Sep 25, 2020 at 03:03:42PM -0400, Chuck Lever 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/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.
Oops, right, I should have warned that was untested! I don't know how
it got past me that I was trying to read rqst before it was set....
The other two lines aren't needed, though.
(The only place we read rq_lease_breaker is in nfsd_breaker_owns_lease(),
and only after we've checked that we're running as an nfsd thread
processing an NFSv4 rpc.
Such a thread shouldn't touch the filesystem and trigger this callback
until it's in nfsd4_proc_compound. Which sets rq_lease_breaker at the
start.)
--b.
commit 4abef2c530f7
Author: J. Bruce Fields <bfields@redhat.com>
Date: Fri Sep 25 10:12:39 2020 -0400
nfsd: rq_lease_breaker cleanup
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>
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 62afcae18e17..c13b04718a3f 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4598,6 +4598,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;
clp = *(rqst->rq_lease_breaker);
return dl->dl_stid.sc_client == clp;
}
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index b603dfcdd361..8d6f6f4c8b28 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)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] nfsd: rq_lease_breaker cleanup
2020-09-25 20:48 ` J. Bruce Fields
@ 2020-09-25 20:49 ` Chuck Lever
2020-09-25 21:02 ` Bruce Fields
0 siblings, 1 reply; 4+ messages in thread
From: Chuck Lever @ 2020-09-25 20:49 UTC (permalink / raw)
To: Bruce Fields; +Cc: Linux NFS Mailing List
> On Sep 25, 2020, at 4:48 PM, J. Bruce Fields <bfields@fieldses.org> wrote:
>
> On Fri, Sep 25, 2020 at 03:03:42PM -0400, Chuck Lever 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/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.
>
> Oops, right, I should have warned that was untested! I don't know how
> it got past me that I was trying to read rqst before it was set....
>
> The other two lines aren't needed, though.
>
> (The only place we read rq_lease_breaker is in nfsd_breaker_owns_lease(),
> and only after we've checked that we're running as an nfsd thread
> processing an NFSv4 rpc.
>
> Such a thread shouldn't touch the filesystem and trigger this callback
> until it's in nfsd4_proc_compound. Which sets rq_lease_breaker at the
> start.)
>
> --b.
>
> commit 4abef2c530f7
> Author: J. Bruce Fields <bfields@redhat.com>
> Date: Fri Sep 25 10:12:39 2020 -0400
>
> nfsd: rq_lease_breaker cleanup
>
> 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>
>
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 62afcae18e17..c13b04718a3f 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -4598,6 +4598,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;
Am I missing a patch that removes
if (!rqst->rq_lease_breaker)
return NULL;
> clp = *(rqst->rq_lease_breaker);
> return dl->dl_stid.sc_client == clp;
> }
> diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
> index b603dfcdd361..8d6f6f4c8b28 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] nfsd: rq_lease_breaker cleanup
2020-09-25 20:49 ` Chuck Lever
@ 2020-09-25 21:02 ` Bruce Fields
0 siblings, 0 replies; 4+ messages in thread
From: Bruce Fields @ 2020-09-25 21:02 UTC (permalink / raw)
To: Chuck Lever; +Cc: Linux NFS Mailing List
On Fri, Sep 25, 2020 at 04:49:57PM -0400, Chuck Lever wrote:
> Am I missing a patch that removes
>
> if (!rqst->rq_lease_breaker)
> return NULL;
I've been working off 5.9-rc1, which doesn't have it, sorry about that.
--b.
commit 58b869423e3d
Author: J. Bruce Fields <bfields@redhat.com>
Date: Fri Sep 25 10:12:39 2020 -0400
nfsd: rq_lease_breaker cleanup
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>
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index a59551efd263..4f3964582b68 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4598,7 +4598,8 @@ static bool nfsd_breaker_owns_lease(struct file_lock *fl)
if (!i_am_nfsd())
return NULL;
rqst = kthread_data(current);
- if (!rqst->rq_lease_breaker)
+ /* Note rq_prog == NFS_ACL_PROGRAM is also possible: */
+ if (rqst->rq_prog != NFS_PROGRAM || rqst->rq_vers < 4)
return NULL;
clp = *(rqst->rq_lease_breaker);
return dl->dl_stid.sc_client == clp;
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)
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-09-25 21:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-25 19:03 [PATCH] nfsd: rq_lease_breaker cleanup Chuck Lever
2020-09-25 20:48 ` J. Bruce Fields
2020-09-25 20:49 ` Chuck Lever
2020-09-25 21:02 ` Bruce Fields
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.