diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-10-08 14:33:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-08 18:34:56 -0400 |
commit | 0bae89ec8b1519dae67036637942f5b5bbaa9424 (patch) | |
tree | 12a37ef553a394f6794af74fa5d46a74350fc02b /fs/nfs | |
parent | cb1055fb1b79775d398038ad8dcd2c7581f141d8 (diff) |
[PATCH] NFS: Fix typo in nfs_get_client()
Commit ca4aa09635516258f158a7bc1594a794e4c34864 fixed waiting for the
structure to get initialised, but it is also possible to break out of
the loop while still in TASK_INTERRUPTIBLE.
Replace the whole thing by wait_event_interruptible, which is much more
readable, and doesn't suffer from these problems.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/client.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index d2533e214255..013cdbc3b000 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -322,25 +322,11 @@ found_client: | |||
322 | if (new) | 322 | if (new) |
323 | nfs_free_client(new); | 323 | nfs_free_client(new); |
324 | 324 | ||
325 | if (clp->cl_cons_state == NFS_CS_INITING) { | 325 | error = wait_event_interruptible(&nfs_client_active_wq, |
326 | DECLARE_WAITQUEUE(myself, current); | 326 | clp->cl_cons_state != NFS_CS_INITING); |
327 | 327 | if (error < 0) { | |
328 | add_wait_queue(&nfs_client_active_wq, &myself); | 328 | nfs_put_client(clp); |
329 | 329 | return ERR_PTR(-ERESTARTSYS); | |
330 | for (;;) { | ||
331 | set_current_state(TASK_INTERRUPTIBLE); | ||
332 | if (signal_pending(current) || | ||
333 | clp->cl_cons_state != NFS_CS_INITING) | ||
334 | break; | ||
335 | schedule(); | ||
336 | } | ||
337 | |||
338 | remove_wait_queue(&nfs_client_active_wq, &myself); | ||
339 | |||
340 | if (signal_pending(current)) { | ||
341 | nfs_put_client(clp); | ||
342 | return ERR_PTR(-ERESTARTSYS); | ||
343 | } | ||
344 | } | 330 | } |
345 | 331 | ||
346 | if (clp->cl_cons_state < NFS_CS_READY) { | 332 | if (clp->cl_cons_state < NFS_CS_READY) { |