]> err.no Git - linux-2.6/commitdiff
[PATCH] NFS: Fix typo in nfs_get_client()
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Sun, 8 Oct 2006 18:33:24 +0000 (14:33 -0400)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 8 Oct 2006 22:34:56 +0000 (15:34 -0700)
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>
fs/nfs/client.c

index d2533e214255b4a7287138ab09ca38beaf133b54..013cdbc3b000f152aba6479317cd66e9d35865d5 100644 (file)
@@ -322,25 +322,11 @@ found_client:
        if (new)
                nfs_free_client(new);
 
-       if (clp->cl_cons_state == NFS_CS_INITING) {
-               DECLARE_WAITQUEUE(myself, current);
-
-               add_wait_queue(&nfs_client_active_wq, &myself);
-
-               for (;;) {
-                       set_current_state(TASK_INTERRUPTIBLE);
-                       if (signal_pending(current) ||
-                           clp->cl_cons_state != NFS_CS_INITING)
-                               break;
-                       schedule();
-               }
-
-               remove_wait_queue(&nfs_client_active_wq, &myself);
-
-               if (signal_pending(current)) {
-                       nfs_put_client(clp);
-                       return ERR_PTR(-ERESTARTSYS);
-               }
+       error = wait_event_interruptible(&nfs_client_active_wq,
+                               clp->cl_cons_state != NFS_CS_INITING);
+       if (error < 0) {
+               nfs_put_client(clp);
+               return ERR_PTR(-ERESTARTSYS);
        }
 
        if (clp->cl_cons_state < NFS_CS_READY) {