Samuel Mendoza-Jonas | a64c380 | 2017-10-23 15:22:55 +1100 | [diff] [blame] | 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | From: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com> |
| 3 | Date: Mon, 16 Oct 2017 17:22:31 -0700 |
| 4 | Subject: [PATCH 4/5] scsi: aacraid: Fix controller initialization failure |
| 5 | |
| 6 | This is a fix to an issue where the driver sends its periodic WELLNESS |
| 7 | command to the controller after the driver shut it down.This causes the |
| 8 | controller to crash. The window where this can happen is small, but it |
| 9 | can be hit at around 4 hours of constant resets. |
| 10 | |
| 11 | Cc: <stable@vger.kernel.org> |
| 12 | Fixes: fbd185986eba (aacraid: Fix AIF triggered IOP_RESET) |
| 13 | Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com> |
| 14 | Reviewed-by: Dave Carroll <david.carroll@microsemi.com> |
| 15 | Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> |
| 16 | (cherry picked from commit 45348de2c8a7a1e64c5be27b22c9786b4152dd41) |
| 17 | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> |
| 18 | --- |
| 19 | drivers/scsi/aacraid/comminit.c | 8 +++++--- |
| 20 | drivers/scsi/aacraid/linit.c | 7 ++++++- |
| 21 | 2 files changed, 11 insertions(+), 4 deletions(-) |
| 22 | |
| 23 | diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c |
| 24 | index 9ee025b1d0e0..289b6fe306fd 100644 |
| 25 | --- a/drivers/scsi/aacraid/comminit.c |
| 26 | +++ b/drivers/scsi/aacraid/comminit.c |
| 27 | @@ -302,9 +302,11 @@ int aac_send_shutdown(struct aac_dev * dev) |
| 28 | return -ENOMEM; |
| 29 | aac_fib_init(fibctx); |
| 30 | |
| 31 | - mutex_lock(&dev->ioctl_mutex); |
| 32 | - dev->adapter_shutdown = 1; |
| 33 | - mutex_unlock(&dev->ioctl_mutex); |
| 34 | + if (!dev->adapter_shutdown) { |
| 35 | + mutex_lock(&dev->ioctl_mutex); |
| 36 | + dev->adapter_shutdown = 1; |
| 37 | + mutex_unlock(&dev->ioctl_mutex); |
| 38 | + } |
| 39 | |
| 40 | cmd = (struct aac_close *) fib_data(fibctx); |
| 41 | cmd->command = cpu_to_le32(VM_CloseAll); |
| 42 | diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c |
| 43 | index 0f277df73af0..231bd3345f44 100644 |
| 44 | --- a/drivers/scsi/aacraid/linit.c |
| 45 | +++ b/drivers/scsi/aacraid/linit.c |
| 46 | @@ -1401,8 +1401,9 @@ static void __aac_shutdown(struct aac_dev * aac) |
| 47 | { |
| 48 | int i; |
| 49 | |
| 50 | + mutex_lock(&aac->ioctl_mutex); |
| 51 | aac->adapter_shutdown = 1; |
| 52 | - aac_send_shutdown(aac); |
| 53 | + mutex_unlock(&aac->ioctl_mutex); |
| 54 | |
| 55 | if (aac->aif_thread) { |
| 56 | int i; |
| 57 | @@ -1415,7 +1416,11 @@ static void __aac_shutdown(struct aac_dev * aac) |
| 58 | } |
| 59 | kthread_stop(aac->thread); |
| 60 | } |
| 61 | + |
| 62 | + aac_send_shutdown(aac); |
| 63 | + |
| 64 | aac_adapter_disable_int(aac); |
| 65 | + |
| 66 | if (aac_is_src(aac)) { |
| 67 | if (aac->max_msix > 1) { |
| 68 | for (i = 0; i < aac->max_msix; i++) { |