Skip to contentSkip to conversation

sunrpc: replace sleep_on_timeout()

PATCH In review Thomas Gleixner 3 participants 4 messages Oct 20, 2004 – Oct 21, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sunrpc: replace sleep_on_timeout()

Use wait_event_timeout() instead of the obsolete sleep_on_timeout()

---

 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) {
_

#1 lore raw

on den 20.10.2004 Klokka 21:21 (+0200) skreiv Thomas Gleixner:

Quoted 15 lines

Use wait_event_timeout() instead of the obsolete sleep_on_timeout()

---

 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

Review rpc_shutdown_client(struct rpc_clnt *cln · line 237

Quoted 8 lines
(quoted diff) +2 -1
@@ -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

Signature · 1 line
Trond Myklebust <[email protected]>
#2 lore raw
Quoted 11 lines · Trond Myklebust

Review

Quoted 5 lines
(quoted diff) +2 -1
-		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

#3 lore raw

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

Quoted 4 lines

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

Signature · 1 line
Trond Myklebust <[email protected]>