]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
aacraid: Fix for aac_command_thread hang
authorRaghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Tue, 26 Apr 2016 06:31:57 +0000 (23:31 -0700)
committerChuck Anderson <chuck.anderson@oracle.com>
Mon, 27 Feb 2017 06:21:05 +0000 (22:21 -0800)
Typically under error conditions, it is possible for aac_command_thread()
to miss the wakeup from kthread_stop() and go back to sleep, causing it
to hang aac_shutdown.

In the observed scenario, the adapter is not functioning correctly and so
aac_fib_send() never completes (or time-outs depending on how it was
called). Shortly after aac_command_thread() starts it performs
aac_fib_send(SendHostTime) which hangs. When aac_probe_one
/aac_get_adapter_info send time outs, kthread_stop is called which breaks
the command thread out of it's hang.

The code will still go back to sleep in schedule_timeout() without
checking kthread_should_stop() so it causes aac_probe_one to hang until
the schedule_timeout() which is 30 minutes.

Fixed by: Adding another kthread_should_stop() before schedule_timeout()
Cc: stable@vger.kernel.org
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit fc4bf75ea300a5e62a2419f89dd0e22189dd7ab7)
Orabug: 25505509
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
drivers/scsi/aacraid/commsup.c

index 9562f1626a6efce37ad96e9ca61da6dd29af9909..123912137ee217d8ce1ba964d3f1ca3f44134da5 100644 (file)
@@ -1965,6 +1965,10 @@ int aac_command_thread(void *data)
                if (difference <= 0)
                        difference = 1;
                set_current_state(TASK_INTERRUPTIBLE);
+
+               if (kthread_should_stop())
+                       break;
+
                schedule_timeout(difference);
 
                if (kthread_should_stop())