linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] SUNRPC: Make use of the helper macro kthread_run()
@ 2021-10-21  8:43 Cai Huoqing
  2021-10-21 13:16 ` Trond Myklebust
  0 siblings, 1 reply; 2+ messages in thread
From: Cai Huoqing @ 2021-10-21  8:43 UTC (permalink / raw)
  To: caihuoqing
  Cc: J. Bruce Fields, Chuck Lever, Trond Myklebust, Anna Schumaker,
	linux-nfs, linux-kernel

Repalce kthread_create/wake_up_process() with kthread_run()
to simplify the code.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 fs/lockd/svc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index b220e1b91726..934dc13a7011 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -397,7 +397,7 @@ static int lockd_start_svc(struct svc_serv *serv)
 	svc_sock_update_bufs(serv);
 	serv->sv_maxconn = nlm_max_connections;
 
-	nlmsvc_task = kthread_create(lockd, nlmsvc_rqst, "%s", serv->sv_name);
+	nlmsvc_task = kthread_run(lockd, nlmsvc_rqst, "%s", serv->sv_name);
 	if (IS_ERR(nlmsvc_task)) {
 		error = PTR_ERR(nlmsvc_task);
 		printk(KERN_WARNING
@@ -405,7 +405,6 @@ static int lockd_start_svc(struct svc_serv *serv)
 		goto out_task;
 	}
 	nlmsvc_rqst->rq_task = nlmsvc_task;
-	wake_up_process(nlmsvc_task);
 
 	dprintk("lockd_up: service started\n");
 	return 0;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] SUNRPC: Make use of the helper macro kthread_run()
  2021-10-21  8:43 [PATCH] SUNRPC: Make use of the helper macro kthread_run() Cai Huoqing
@ 2021-10-21 13:16 ` Trond Myklebust
  0 siblings, 0 replies; 2+ messages in thread
From: Trond Myklebust @ 2021-10-21 13:16 UTC (permalink / raw)
  To: caihuoqing; +Cc: bfields, linux-nfs, anna.schumaker, linux-kernel, chuck.lever

On Thu, 2021-10-21 at 16:43 +0800, Cai Huoqing wrote:
> [You don't often get email from caihuoqing@baidu.com. Learn why this
> is important at http://aka.ms/LearnAboutSenderIdentification.]
> 
> Repalce kthread_create/wake_up_process() with kthread_run()
> to simplify the code.
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
> ---
>  fs/lockd/svc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
> index b220e1b91726..934dc13a7011 100644
> --- a/fs/lockd/svc.c
> +++ b/fs/lockd/svc.c
> @@ -397,7 +397,7 @@ static int lockd_start_svc(struct svc_serv *serv)
>         svc_sock_update_bufs(serv);
>         serv->sv_maxconn = nlm_max_connections;
> 
> -       nlmsvc_task = kthread_create(lockd, nlmsvc_rqst, "%s", serv-
> >sv_name);
> +       nlmsvc_task = kthread_run(lockd, nlmsvc_rqst, "%s", serv-
> >sv_name);
>         if (IS_ERR(nlmsvc_task)) {
>                 error = PTR_ERR(nlmsvc_task);
>                 printk(KERN_WARNING
> @@ -405,7 +405,6 @@ static int lockd_start_svc(struct svc_serv *serv)
>                 goto out_task;
>         }
>         nlmsvc_rqst->rq_task = nlmsvc_task;
> -       wake_up_process(nlmsvc_task);

No. That would mean nlmsvc_rqst->rq_task would be uninitialised when
the thread starts. Please try to understand the code before proposing
changes.

> 
>         dprintk("lockd_up: service started\n");
>         return 0;
> --
> 2.25.1
> 

-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-21 13:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21  8:43 [PATCH] SUNRPC: Make use of the helper macro kthread_run() Cai Huoqing
2021-10-21 13:16 ` Trond Myklebust

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).