[SCSI] zfcp: fix deadlock between wq triggered port scan and ERP
authorSwen Schillig <swen@vnet.ibm.com>
Wed, 26 Nov 2008 17:07:40 +0000 (18:07 +0100)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Mon, 1 Dec 2008 16:18:04 +0000 (10:18 -0600)
Waiting for the ERP to be finished in a task running in the global
kernel work-queue is a bad idea, especially if the ERP needs to run
another job in this work-queue before it can finish. -> deadlock.

This patch removes the necessity to wait for a finished ERP from the
scan task and moves the job scheduling to the end of the ERP.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/s390/scsi/zfcp_erp.c
drivers/s390/scsi/zfcp_fc.c

index c55dd2728f907b24af8b8748439a1ca86a62d8dc..c557ba34e1aab5b2c5b7d732e9e076620e9dcc94 100644 (file)
@@ -720,7 +720,6 @@ static int zfcp_erp_adapter_strategy_generic(struct zfcp_erp_action *act,
                goto failed_openfcp;
 
        atomic_set_mask(ZFCP_STATUS_COMMON_OPEN, &act->adapter->status);
-       schedule_work(&act->adapter->scan_work);
 
        return ZFCP_ERP_SUCCEEDED;
 
@@ -1284,6 +1283,8 @@ static void zfcp_erp_action_cleanup(struct zfcp_erp_action *act, int result)
        case ZFCP_ERP_ACTION_REOPEN_ADAPTER:
                if (result != ZFCP_ERP_SUCCEEDED)
                        zfcp_erp_rports_del(adapter);
+               else
+                       schedule_work(&adapter->scan_work);
                zfcp_adapter_put(adapter);
                break;
        }
index ae151390cb9f63c8b8b138cfe9f7b750f256b7c6..8aab3091a7b1045488887b352e4eebcecf23a21c 100644 (file)
@@ -610,7 +610,6 @@ int zfcp_scan_ports(struct zfcp_adapter *adapter)
        int ret, i;
        struct zfcp_gpn_ft *gpn_ft;
 
-       zfcp_erp_wait(adapter); /* wait until adapter is finished with ERP */
        if (fc_host_port_type(adapter->scsi_host) != FC_PORTTYPE_NPORT)
                return 0;