]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[SCSI] ibmvfc: Fix another hang on module removal
authorBrian King <brking@linux.vnet.ibm.com>
Fri, 15 Aug 2008 15:59:21 +0000 (10:59 -0500)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Sat, 16 Aug 2008 15:47:46 +0000 (10:47 -0500)
This fixes a hang on module removal. The module removal code was setting
the hosts's state to IBMVFC_HOST_OFFLINE before tearing down the kernel
thread, but, due to a bug in ibmvfc_wait_while_resetting, was not waiting
for the kernel thread's offlining work to be done prior to destroying
the kernel thread, which left the scsi host in a blocked state which we
never got out of.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/ibmvscsi/ibmvfc.c

index ae560bc04f9d4df009ad8aef36abfa288dfca2f2..ee11568d581f9f0e9bfa617eb6b37f04b6595d2e 100644 (file)
@@ -1059,9 +1059,10 @@ static void ibmvfc_get_starget_port_id(struct scsi_target *starget)
 static int ibmvfc_wait_while_resetting(struct ibmvfc_host *vhost)
 {
        long timeout = wait_event_timeout(vhost->init_wait_q,
-                                         (vhost->state == IBMVFC_ACTIVE ||
-                                          vhost->state == IBMVFC_HOST_OFFLINE ||
-                                          vhost->state == IBMVFC_LINK_DEAD),
+                                         ((vhost->state == IBMVFC_ACTIVE ||
+                                           vhost->state == IBMVFC_HOST_OFFLINE ||
+                                           vhost->state == IBMVFC_LINK_DEAD) &&
+                                          vhost->action == IBMVFC_HOST_ACTION_NONE),
                                          (init_timeout * HZ));
 
        return timeout ? 0 : -EIO;