[PATCH 10/16] aacraid: Terminate kthread on controller fw assert

Raghava Aditya Renukunta
2017-02-15T03:22:38Z

When the command thread performs a periodic time sync and the firmware is
going through an assert during that time, the command thread waits for the
response that would never arrive. The SCSI Mid layer's error handler would
eventually reset the controller, but the eh_handler just issues a
"thread stop" to the command thread which is stuck on a semaphore and the
eh_thread would in turn goes to sleep waiting for the command_thread to
respond to the stop which never happens.

Fixed by allowing SIGTERM for the command thread, and during the eh_reset
call, sends termination signal to the command thread. As a follow-up, the
eh_reset handler would take care of the controller reset.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: David Carroll <David.Carroll@microsemi.com>
---
drivers/scsi/aacraid/commsup.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 78588e4..0ee91d0 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1519,8 +1519,15 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
scsi_block_requests(host);
aac_adapter_disable_int(aac);
if (aac->thread->pid != current->pid) {
+ struct task_struct *tsk;
+
spin_unlock_irq(host->host_lock);
+ tsk = pid_task(find_vpid(aac->thread->pid), PIDTYPE_PID);
+ if (tsk)
+ send_sig(SIGTERM, tsk, 1);
kthread_stop(aac->thread);
+
+ dev_info(&aac->pdev->dev, "Command Thread Terminated\n");
jafo = 1;
}

--
2.7.4