linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sunrpc: replace sleep_on_timeout()
@ 2004-10-20 19:21 Thomas Gleixner
  2004-10-21  7:26 ` Trond Myklebust
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2004-10-20 19:21 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Ingo Molnar, LKML


Use wait_event_timeout() instead of the obsolete sleep_on_timeout()

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Ingo Molnar <mingo@elte.hu>
---

 2.6.9-bk-041020-thomas/net/sunrpc/clnt.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

diff -puN net/sunrpc/clnt.c~sunrpc net/sunrpc/clnt.c
--- 2.6.9-bk-041020/net/sunrpc/clnt.c~sunrpc	2004-10-20
15:56:37.000000000 +0200
+++ 2.6.9-bk-041020-thomas/net/sunrpc/clnt.c	2004-10-20
15:56:37.000000000 +0200
@@ -231,7 +231,8 @@ rpc_shutdown_client(struct rpc_clnt *cln
 		clnt->cl_oneshot = 0;
 		clnt->cl_dead = 0;
 		rpc_killall_tasks(clnt);
-		sleep_on_timeout(&destroy_wait, 1*HZ);
+		wait_event_timeout(destroy_wait,
+			atomic_read(&clnt->cl_users) > 0, 1*HZ);
 	}
 
 	if (atomic_read(&clnt->cl_users) < 0) {
_



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

* Re: [PATCH] sunrpc: replace sleep_on_timeout()
  2004-10-20 19:21 [PATCH] sunrpc: replace sleep_on_timeout() Thomas Gleixner
@ 2004-10-21  7:26 ` Trond Myklebust
  2004-10-21  7:42   ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Trond Myklebust @ 2004-10-21  7:26 UTC (permalink / raw)
  To: tglx; +Cc: Andrew Morton, Ingo Molnar, LKML

on den 20.10.2004 Klokka 21:21 (+0200) skreiv Thomas Gleixner:
> Use wait_event_timeout() instead of the obsolete sleep_on_timeout()
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Acked-by: Ingo Molnar <mingo@elte.hu>
> ---
> 
>  2.6.9-bk-041020-thomas/net/sunrpc/clnt.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff -puN net/sunrpc/clnt.c~sunrpc net/sunrpc/clnt.c
> --- 2.6.9-bk-041020/net/sunrpc/clnt.c~sunrpc	2004-10-20
> 15:56:37.000000000 +0200
> +++ 2.6.9-bk-041020-thomas/net/sunrpc/clnt.c	2004-10-20
> 15:56:37.000000000 +0200
> @@ -231,7 +231,8 @@ rpc_shutdown_client(struct rpc_clnt *cln
>  		clnt->cl_oneshot = 0;
>  		clnt->cl_dead = 0;
>  		rpc_killall_tasks(clnt);
> -		sleep_on_timeout(&destroy_wait, 1*HZ);
> +		wait_event_timeout(destroy_wait,
> +			atomic_read(&clnt->cl_users) > 0, 1*HZ);
>  	}
>  

No. The above is incorrect, and has the potential for a pretty
catastrophic hang due to the enclosing loop. Please replace with

	wait_event_timeout(destroy_wait, atomic_read(&clnt->cl_users) == 0,
1*HZ);

   Trond

-- 
Trond Myklebust <trond.myklebust@fys.uio.no>


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

* Re: [PATCH] sunrpc: replace sleep_on_timeout()
  2004-10-21  7:26 ` Trond Myklebust
@ 2004-10-21  7:42   ` Ingo Molnar
  2004-10-21  8:24     ` Trond Myklebust
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2004-10-21  7:42 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: tglx, Andrew Morton, LKML


* Trond Myklebust <trond.myklebust@fys.uio.no> wrote:

> > -		sleep_on_timeout(&destroy_wait, 1*HZ);
> > +		wait_event_timeout(destroy_wait,
> > +			atomic_read(&clnt->cl_users) > 0, 1*HZ);
> >  	}
> >  
> 
> No. The above is incorrect, and has the potential for a pretty
> catastrophic hang due to the enclosing loop. Please replace with
> 
> 	wait_event_timeout(destroy_wait, atomic_read(&clnt->cl_users) == 0,
> 1*HZ);

ah, indeed. Do you in principle agree with these sleep_on() =>
wait_event*() conversions in the NFS code? (as long as they are
correct). sleep_on() is really becoming an architectural wart these
days.

	Ingo

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

* Re: [PATCH] sunrpc: replace sleep_on_timeout()
  2004-10-21  7:42   ` Ingo Molnar
@ 2004-10-21  8:24     ` Trond Myklebust
  0 siblings, 0 replies; 4+ messages in thread
From: Trond Myklebust @ 2004-10-21  8:24 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: tglx, Andrew Morton, LKML

to den 21.10.2004 Klokka 09:42 (+0200) skreiv Ingo Molnar:

> ah, indeed. Do you in principle agree with these sleep_on() =>
> wait_event*() conversions in the NFS code? (as long as they are
> correct). sleep_on() is really becoming an architectural wart these
> days.

Sure. Feel free to fix them up, but carefully please. ;-)

Cheers,
  Trond

-- 
Trond Myklebust <trond.myklebust@fys.uio.no>


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

end of thread, other threads:[~2004-10-21  8:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-20 19:21 [PATCH] sunrpc: replace sleep_on_timeout() Thomas Gleixner
2004-10-21  7:26 ` Trond Myklebust
2004-10-21  7:42   ` Ingo Molnar
2004-10-21  8:24     ` 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).