Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0bae89ec authored by Trond Myklebust's avatar Trond Myklebust Committed by Linus Torvalds
Browse files

[PATCH] NFS: Fix typo in nfs_get_client()



Commit ca4aa096 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: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent cb1055fb
Loading
Loading
Loading
Loading
+5 −19
Original line number Diff line number Diff line
@@ -322,26 +322,12 @@ static struct nfs_client *nfs_get_client(const char *hostname,
	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)) {
	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) {
		error = clp->cl_cons_state;