Message ID | 168966228861.11075.6512110736168003985.stgit@noble.brown (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Refactor SUNRPC svc thread code, and use llist | expand |
On Tue, 2023-07-18 at 16:38 +1000, NeilBrown wrote: > All callers of svc_recv() go on to call svc_process() on success. > Simplify callers by having svc_recv() do that for them. > > This loses one call to validate_process_creds() in nfsd. That was > debugging code added 14 years ago. I don't think we need to keep it. > > Signed-off-by: NeilBrown <neilb@suse.de> > --- > fs/lockd/svc.c | 5 ----- > fs/nfs/callback.c | 1 - > fs/nfsd/nfssvc.c | 2 -- > net/sunrpc/svc_xprt.c | 3 ++- > 4 files changed, 2 insertions(+), 9 deletions(-) > > diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c > index 614faa5f69cd..91ef139a7757 100644 > --- a/fs/lockd/svc.c > +++ b/fs/lockd/svc.c > @@ -132,7 +132,6 @@ lockd(void *vrqstp) > */ > while (!kthread_should_stop()) { > long timeout = MAX_SCHEDULE_TIMEOUT; > - RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]); > > /* update sv_maxconn if it has changed */ > rqstp->rq_server->sv_maxconn = nlm_max_connections; > @@ -146,10 +145,6 @@ lockd(void *vrqstp) > err = svc_recv(rqstp, timeout); > if (err == -EAGAIN || err == -EINTR) > continue; > - dprintk("lockd: request from %s\n", > - svc_print_addr(rqstp, buf, sizeof(buf))); > - > - svc_process(rqstp); > } > if (nlmsvc_ops) > nlmsvc_invalidate_all(); > diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c > index 46a0a2d6962e..2d94384bd6a9 100644 > --- a/fs/nfs/callback.c > +++ b/fs/nfs/callback.c > @@ -86,7 +86,6 @@ nfs4_callback_svc(void *vrqstp) > err = svc_recv(rqstp, MAX_SCHEDULE_TIMEOUT); > if (err == -EAGAIN || err == -EINTR) > continue; > - svc_process(rqstp); > } > > svc_exit_thread(rqstp); > diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c > index 439fca195925..3e08cc746870 100644 > --- a/fs/nfsd/nfssvc.c > +++ b/fs/nfsd/nfssvc.c > @@ -985,8 +985,6 @@ nfsd(void *vrqstp) > if (err == -EINTR) > break; > validate_process_creds(); > - svc_process(rqstp); > - validate_process_creds(); > } > > atomic_dec(&nfsdstats.th_cnt); > diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c > index 93395606a0ba..c808f6d60c99 100644 > --- a/net/sunrpc/svc_xprt.c > +++ b/net/sunrpc/svc_xprt.c > @@ -895,7 +895,8 @@ int svc_recv(struct svc_rqst *rqstp, long timeout) > serv->sv_stats->netcnt++; > percpu_counter_inc(&rqstp->rq_pool->sp_messages_arrived); > rqstp->rq_stime = ktime_get(); > - return len; > + svc_process(rqstp); > + return 0; > out_release: > rqstp->rq_res.len = 0; > svc_xprt_release(rqstp); > > Reviewed-by: Jeff Layton <jlayton@kernel.org>
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 614faa5f69cd..91ef139a7757 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c @@ -132,7 +132,6 @@ lockd(void *vrqstp) */ while (!kthread_should_stop()) { long timeout = MAX_SCHEDULE_TIMEOUT; - RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]); /* update sv_maxconn if it has changed */ rqstp->rq_server->sv_maxconn = nlm_max_connections; @@ -146,10 +145,6 @@ lockd(void *vrqstp) err = svc_recv(rqstp, timeout); if (err == -EAGAIN || err == -EINTR) continue; - dprintk("lockd: request from %s\n", - svc_print_addr(rqstp, buf, sizeof(buf))); - - svc_process(rqstp); } if (nlmsvc_ops) nlmsvc_invalidate_all(); diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index 46a0a2d6962e..2d94384bd6a9 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c @@ -86,7 +86,6 @@ nfs4_callback_svc(void *vrqstp) err = svc_recv(rqstp, MAX_SCHEDULE_TIMEOUT); if (err == -EAGAIN || err == -EINTR) continue; - svc_process(rqstp); } svc_exit_thread(rqstp); diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 439fca195925..3e08cc746870 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c @@ -985,8 +985,6 @@ nfsd(void *vrqstp) if (err == -EINTR) break; validate_process_creds(); - svc_process(rqstp); - validate_process_creds(); } atomic_dec(&nfsdstats.th_cnt); diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index 93395606a0ba..c808f6d60c99 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c @@ -895,7 +895,8 @@ int svc_recv(struct svc_rqst *rqstp, long timeout) serv->sv_stats->netcnt++; percpu_counter_inc(&rqstp->rq_pool->sp_messages_arrived); rqstp->rq_stime = ktime_get(); - return len; + svc_process(rqstp); + return 0; out_release: rqstp->rq_res.len = 0; svc_xprt_release(rqstp);
All callers of svc_recv() go on to call svc_process() on success. Simplify callers by having svc_recv() do that for them. This loses one call to validate_process_creds() in nfsd. That was debugging code added 14 years ago. I don't think we need to keep it. Signed-off-by: NeilBrown <neilb@suse.de> --- fs/lockd/svc.c | 5 ----- fs/nfs/callback.c | 1 - fs/nfsd/nfssvc.c | 2 -- net/sunrpc/svc_xprt.c | 3 ++- 4 files changed, 2 insertions(+), 9 deletions(-)