scsi: aacraid: Block concurrent hotplug event handling
authorRaghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Wed, 27 Dec 2017 04:34:44 +0000 (20:34 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 4 Jan 2018 04:26:43 +0000 (23:26 -0500)
Currently driver will attempt to process hotplug events concurrently based
on the FW interrupt.

Protect safw update function with a scan mutex.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/aacraid/aacraid.h
drivers/scsi/aacraid/commsup.c
drivers/scsi/aacraid/linit.c

index a8fe1e1272c18e6aaa3cf33ce36cb7392d877390..c70c998743ac4a308f97ebac36a75770c974dc80 100644 (file)
@@ -1565,6 +1565,7 @@ struct aac_dev
        spinlock_t              fib_lock;
 
        struct mutex            ioctl_mutex;
+       struct mutex            scan_mutex;
        struct aac_queue_block *queues;
        /*
         *      The user API will use an IOCTL to register itself to receive
index 34155b1aa83e2e6a828ef67e6c265c34593190b8..491e6338c483b8a1830ee727d3af5fecf02fbfd4 100644 (file)
@@ -1997,7 +1997,9 @@ static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr)
        case SA_AIF_LDEV_CHANGE:
        case SA_AIF_BPCFG_CHANGE:
 
+               mutex_lock(&dev->scan_mutex);
                aac_update_safw_host_devices(dev, AAC_RESCAN);
+               mutex_unlock(&dev->scan_mutex);
                break;
 
        case SA_AIF_BPSTAT_CHANGE:
index b2273e3cba6247b0964600490bf4fe0ad7c90255..2c862cd26a21b53b188bea0b2e275c18c8e9948c 100644 (file)
@@ -1683,6 +1683,7 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        spin_lock_init(&aac->fib_lock);
 
        mutex_init(&aac->ioctl_mutex);
+       mutex_init(&aac->scan_mutex);
        /*
         *      Map in the registers from the adapter.
         */