qla2xxx: Schedule board_disable only once
authorJoe Lawrence <joe.lawrence@stratus.com>
Tue, 26 Aug 2014 21:12:01 +0000 (17:12 -0400)
committerChristoph Hellwig <hch@lst.de>
Tue, 16 Sep 2014 16:10:00 +0000 (09:10 -0700)
There are various callers of qla2x00_check_reg{32,16}_for_disconnect
that may schedule board removal on PCI-disconnect. Test-and-set a
dedicated flag before scheduling board_disable so it is invoked only
once.

Signed-off-by: Joe Lawrence <joe.lawrence@stratus.com>
Acked-by: Chad Dupuis <chad.dupuis@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/qla2xxx/qla_def.h
drivers/scsi/qla2xxx/qla_isr.c

index b643991531359e6a4ed4eb842561f1ffaa11ceba..4267ec6f3258816b726dc99ffaa7667f4765c376 100644 (file)
@@ -3402,6 +3402,9 @@ typedef struct scsi_qla_host {
 #define FX00_CRITEMP_RECOVERY  25
 #define FX00_HOST_INFO_RESEND  26
 
+       unsigned long   pci_flags;
+#define PFLG_DISCONNECTED      0       /* PCI device removed */
+
        uint32_t        device_flags;
 #define SWITCH_FOUND           BIT_0
 #define DFLG_NO_CABLE          BIT_1
index 016ebed880f52a8a61f1f92ffdeb6ad714663d51..fd75b9139693ce0ca4c25052ea7e3d456704d2e6 100644 (file)
@@ -117,12 +117,14 @@ qla2x00_check_reg32_for_disconnect(scsi_qla_host_t *vha, uint32_t reg)
 {
        /* Check for PCI disconnection */
        if (reg == 0xffffffff) {
-               /*
-                * Schedule this on the default system workqueue so that all the
-                * adapter workqueues and the DPC thread can be shutdown
-                * cleanly.
-                */
-               schedule_work(&vha->hw->board_disable);
+               if (!test_and_set_bit(PFLG_DISCONNECTED, &vha->pci_flags)) {
+                       /*
+                        * Schedule this (only once) on the default system
+                        * workqueue so that all the adapter workqueues and the
+                        * DPC thread can be shutdown cleanly.
+                        */
+                       schedule_work(&vha->hw->board_disable);
+               }
                return true;
        } else
                return false;