scsi: aacraid: Fix ioctl reset hang
authorRaghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Wed, 27 Dec 2017 04:34:26 +0000 (20:34 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 4 Jan 2018 04:26:41 +0000 (23:26 -0500)
Driver would hang when attempting to send reset from the ioctl interface,
since it would wait to retrieve the ioctl mutex at send shutdown.

Set adapter shutdown and unlock mutex before sending down reset request.

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

index 9ab0fa959d8355c62b8fd0514af8af278898481f..a2b3430072c7e51f55604352f1d9141f5d7f3e2e 100644 (file)
@@ -1052,9 +1052,13 @@ static int aac_send_reset_adapter(struct aac_dev *dev, void __user *arg)
        if (copy_from_user((void *)&reset, arg, sizeof(struct aac_reset_iop)))
                return -EFAULT;
 
+       dev->adapter_shutdown = 1;
+
+       mutex_unlock(&dev->ioctl_mutex);
        retval = aac_reset_adapter(dev, 0, reset.reset_type);
-       return retval;
+       mutex_lock(&dev->ioctl_mutex);
 
+       return retval;
 }
 
 int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg)