]> Pileus Git - ~andy/linux/commitdiff
[SCSI] qla2xxx: Explicitly tear-down vports during PCI remove_one().
authorAndrew Vasquez <andrew.vasquez@qlogic.com>
Thu, 14 Aug 2008 04:37:01 +0000 (21:37 -0700)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Sat, 16 Aug 2008 15:24:12 +0000 (10:24 -0500)
During internal testing, we've seen issues (hangs) with the
'deferred' vport tear-down-processing typically accompanied with
the fc_remove_host() call.  This is due to the current
implementation's back-end vport handling being performed by the
physical-HA's DPC thread where premature shutdown could lead to
latent vport requests without a processor.

This should also address a problem reported by Gal Rosen
(http://marc.info/?l=linux-scsi&m=121731664417358&w=2) where the
driver would attempt to awaken a previously torn-down DPC thread
from interrupt context by implicitly calling wake_up_process()
rather than the driver's qla2xxx_wake_dpc() helper.  Rather, than
reshuffle the remove_one() device-removal code, during unload,
depend on the driver's timer to wake-up the DPC process, by
limiting wake-ups based on an 'unloading' flag.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/qla2xxx/qla_def.h
drivers/scsi/qla2xxx/qla_mbx.c
drivers/scsi/qla2xxx/qla_os.c

index 6da31ba94404f7bf6b48f418a3ba18829569adb8..94a720eabfd83cc491601ba7b53d5bfef82f4ae2 100644 (file)
@@ -2237,6 +2237,7 @@ typedef struct scsi_qla_host {
 #define REGISTER_FDMI_NEEDED   26
 #define FCPORT_UPDATE_NEEDED   27
 #define VP_DPC_NEEDED          28      /* wake up for VP dpc handling */
+#define UNLOADING              29
 
        uint32_t        device_flags;
 #define DFLG_LOCAL_DEVICES             BIT_0
index bc90d6b8d0a0d940bf1114c79c818cebc7ee81c5..813bc7784c0aa8fc6542fbce86ec7e5d8e586662 100644 (file)
@@ -2686,7 +2686,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *ha,
                set_bit(VP_IDX_ACQUIRED, &vha->vp_flags);
                set_bit(VP_DPC_NEEDED, &ha->dpc_flags);
 
-               wake_up_process(ha->dpc_thread);
+               qla2xxx_wake_dpc(ha);
        }
 }
 
index e0880ad243be14815c29dc6954dca9c352aa8a98..26afe44265c794177380eea2b25433d2277761f5 100644 (file)
@@ -1775,10 +1775,15 @@ probe_out:
 static void
 qla2x00_remove_one(struct pci_dev *pdev)
 {
-       scsi_qla_host_t *ha;
+       scsi_qla_host_t *ha, *vha, *temp;
 
        ha = pci_get_drvdata(pdev);
 
+       list_for_each_entry_safe(vha, temp, &ha->vp_list, vp_list)
+               fc_vport_terminate(vha->fc_vport);
+
+       set_bit(UNLOADING, &ha->dpc_flags);
+
        qla2x00_dfs_remove(ha);
 
        qla84xx_put_chip(ha);
@@ -2450,8 +2455,10 @@ qla2x00_do_dpc(void *data)
 void
 qla2xxx_wake_dpc(scsi_qla_host_t *ha)
 {
-       if (ha->dpc_thread)
-               wake_up_process(ha->dpc_thread);
+       struct task_struct *t = ha->dpc_thread;
+
+       if (!test_bit(UNLOADING, &ha->dpc_flags) && t)
+               wake_up_process(t);
 }
 
 /*