diff options
-rw-r--r-- | drivers/scsi/scsi_error.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 410911c31c67..b5bbc122c414 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -2179,8 +2179,17 @@ int scsi_error_handler(void *data) | |||
2179 | * We never actually get interrupted because kthread_run | 2179 | * We never actually get interrupted because kthread_run |
2180 | * disables signal delivery for the created thread. | 2180 | * disables signal delivery for the created thread. |
2181 | */ | 2181 | */ |
2182 | while (!kthread_should_stop()) { | 2182 | while (true) { |
2183 | /* | ||
2184 | * The sequence in kthread_stop() sets the stop flag first | ||
2185 | * then wakes the process. To avoid missed wakeups, the task | ||
2186 | * should always be in a non running state before the stop | ||
2187 | * flag is checked | ||
2188 | */ | ||
2183 | set_current_state(TASK_INTERRUPTIBLE); | 2189 | set_current_state(TASK_INTERRUPTIBLE); |
2190 | if (kthread_should_stop()) | ||
2191 | break; | ||
2192 | |||
2184 | if ((shost->host_failed == 0 && shost->host_eh_scheduled == 0) || | 2193 | if ((shost->host_failed == 0 && shost->host_eh_scheduled == 0) || |
2185 | shost->host_failed != atomic_read(&shost->host_busy)) { | 2194 | shost->host_failed != atomic_read(&shost->host_busy)) { |
2186 | SCSI_LOG_ERROR_RECOVERY(1, | 2195 | SCSI_LOG_ERROR_RECOVERY(1, |