[PATCH] NFS: Fix typo in nfs_get_client()

Commit ca4aa09635 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>
This commit is contained in:
Trond Myklebust 2006-10-08 14:33:24 -04:00 committed by Linus Torvalds
parent cb1055fb1b
commit 0bae89ec8b
1 changed files with 5 additions and 19 deletions

View File

@ -322,25 +322,11 @@ found_client:
if (new) if (new)
nfs_free_client(new); nfs_free_client(new);
if (clp->cl_cons_state == NFS_CS_INITING) { error = wait_event_interruptible(&nfs_client_active_wq,
DECLARE_WAITQUEUE(myself, current); clp->cl_cons_state != NFS_CS_INITING);
if (error < 0) {
add_wait_queue(&nfs_client_active_wq, &myself); nfs_put_client(clp);
return ERR_PTR(-ERESTARTSYS);
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);
}
} }
if (clp->cl_cons_state < NFS_CS_READY) { if (clp->cl_cons_state < NFS_CS_READY) {