Skip to content

Commit fbd1859

Browse files
Raghava Aditya Renukuntamartinkpetersen
authored andcommitted
aacraid: Fix AIF triggered IOP_RESET
while driver removal is in progress or PCI shutdown is invoked, driver kills AIF aacraid thread, but IOCTL requests from the management tools re-start AIF thread leading to IOP_RESET. Fixed by setting adapter_shutdown flag when PCI shutdown is invoked. Signed-off-by: Raghava Aditya Renukunta <[email protected]> Reviewed-by: Shane Seymour <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Reviewed-by: Tomas Henzl <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 222a9fb commit fbd1859

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

drivers/scsi/aacraid/commctrl.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,11 @@ int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg)
857857

858858
mutex_lock(&dev->ioctl_mutex);
859859

860+
if (dev->adapter_shutdown) {
861+
status = -EACCES;
862+
goto cleanup;
863+
}
864+
860865
/*
861866
* HBA gets first crack
862867
*/

drivers/scsi/aacraid/comminit.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,11 @@ int aac_send_shutdown(struct aac_dev * dev)
212212
return -ENOMEM;
213213
aac_fib_init(fibctx);
214214

215-
cmd = (struct aac_close *) fib_data(fibctx);
215+
mutex_lock(&dev->ioctl_mutex);
216+
dev->adapter_shutdown = 1;
217+
mutex_unlock(&dev->ioctl_mutex);
216218

219+
cmd = (struct aac_close *) fib_data(fibctx);
217220
cmd->command = cpu_to_le32(VM_CloseAll);
218221
cmd->cid = cpu_to_le32(0xfffffffe);
219222

@@ -229,7 +232,6 @@ int aac_send_shutdown(struct aac_dev * dev)
229232
/* FIB should be freed only after getting the response from the F/W */
230233
if (status != -ERESTARTSYS)
231234
aac_fib_free(fibctx);
232-
dev->adapter_shutdown = 1;
233235
if ((dev->pdev->device == PMC_DEVICE_S7 ||
234236
dev->pdev->device == PMC_DEVICE_S8 ||
235237
dev->pdev->device == PMC_DEVICE_S9) &&

drivers/scsi/aacraid/linit.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ static long aac_cfg_ioctl(struct file *file,
705705
{
706706
struct aac_dev *aac = (struct aac_dev *)file->private_data;
707707

708-
if (!capable(CAP_SYS_RAWIO) || aac->adapter_shutdown)
708+
if (!capable(CAP_SYS_RAWIO))
709709
return -EPERM;
710710

711711
return aac_do_ioctl(aac, cmd, (void __user *)arg);
@@ -1072,6 +1072,8 @@ static void __aac_shutdown(struct aac_dev * aac)
10721072
int i;
10731073
int cpu;
10741074

1075+
aac_send_shutdown(aac);
1076+
10751077
if (aac->aif_thread) {
10761078
int i;
10771079
/* Clear out events first */
@@ -1083,7 +1085,6 @@ static void __aac_shutdown(struct aac_dev * aac)
10831085
}
10841086
kthread_stop(aac->thread);
10851087
}
1086-
aac_send_shutdown(aac);
10871088
aac_adapter_disable_int(aac);
10881089
cpu = cpumask_first(cpu_online_mask);
10891090
if (aac->pdev->device == PMC_DEVICE_S6 ||

0 commit comments

Comments
 (0)