Michal Hocko
537b604c8b
scsi: fix scsi_error_handler vs. scsi_host_dev_release race
...
b9d5c6b7ef57 ("[SCSI] cleanup setting task state in
scsi_error_handler()") has introduced a race between scsi_error_handler
and scsi_host_dev_release resulting in the hang when the device goes
away because scsi_error_handler might miss a wake up:
CPU0 CPU1
scsi_error_handler scsi_host_dev_release
kthread_stop()
kthread_should_stop()
test_bit(KTHREAD_SHOULD_STOP)
set_bit(KTHREAD_SHOULD_STOP)
wake_up_process()
wait_for_completion()
set_current_state(TASK_INTERRUPTIBLE)
schedule()
The most straightforward solution seems to be to invert the ordering of
the set_current_state and kthread_should_stop.
The issue has been noticed during reboot test on a 3.0 based kernel but
the current code seems to be affected in the same way.
[jejb: additional comment added]
Cc: <stable@vger.kernel.org> # 3.6+
Reported-and-debugged-by: Mike Mayer <Mike.Meyer@teradata.com>
Signed-off-by: Michal Hocko <mhocko@suse.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-09-06 12:05:45 -07:00
..
2015-05-25 08:46:25 -07:00
2015-04-09 13:22:10 -07:00
2015-08-28 13:14:54 -07:00
2014-11-24 14:45:27 +01:00
2015-05-31 18:06:28 -07:00
2015-05-25 08:57:53 -07:00
2015-09-06 11:39:53 -07:00
2014-12-18 05:56:29 -08:00
2015-06-02 17:15:24 -07:00
2015-05-25 08:46:26 -07:00
2015-06-30 19:45:00 -07:00
2015-08-26 18:08:47 -07:00
2015-08-28 13:14:57 -07:00
2015-02-11 10:28:45 -08:00
2015-09-06 11:59:20 -07:00
2015-06-03 12:02:00 +02:00
2015-05-18 13:35:56 -04:00
2015-05-31 18:06:28 -07:00
2015-08-12 11:21:43 -07:00
2015-03-24 17:08:29 -07:00
2015-09-06 11:51:39 -07:00
2015-08-26 07:36:51 -07:00
2015-09-06 11:57:25 -07:00
2015-08-27 11:08:31 -07:00
2015-08-12 11:18:47 -07:00
2015-04-14 09:50:27 -07:00
2015-05-31 18:06:28 -07:00
2015-09-06 11:53:31 -07:00
2015-08-26 17:51:01 -07:00
2015-06-24 16:49:49 -07:00
2015-06-19 16:57:51 -07:00
2014-11-24 14:45:27 +01:00
2015-06-23 15:55:44 -07:00
2015-04-27 10:10:19 -07:00
2015-04-27 10:10:19 -07:00
2015-04-27 10:04:39 -07:00
2015-04-27 10:04:39 -07:00
2015-04-27 10:05:55 -07:00
2015-04-27 10:05:55 -07:00
2014-12-04 09:57:13 +01:00
2015-05-31 18:06:28 -07:00
2013-11-26 11:09:07 +01:00
2014-10-20 16:21:33 +02:00
2014-10-20 16:21:33 +02:00
2015-06-13 08:42:36 -07:00
2015-05-31 18:06:28 -07:00
2015-05-31 18:06:28 -07:00
2015-04-09 18:08:31 -07:00
2015-05-31 18:06:28 -07:00
2015-05-31 18:06:28 -07:00
2015-04-17 10:13:56 -07:00
2015-03-09 10:45:26 -04:00
2015-03-09 07:18:14 -04:00
2015-05-31 18:06:28 -07:00
2015-05-31 18:06:28 -07:00
2015-02-02 09:57:45 -08:00
2013-06-26 18:32:47 -07:00
2014-10-20 16:21:33 +02:00
2015-04-14 09:50:27 -07:00
2015-01-09 15:44:31 +01:00
2015-02-02 09:57:46 -08:00
2014-11-20 09:11:11 +01:00
2015-05-31 18:06:28 -07:00
2014-07-17 22:07:37 +02:00
2014-11-20 09:11:10 +01:00
2014-11-20 09:11:10 +01:00
2015-02-02 09:57:45 -08:00
2014-11-24 14:45:27 +01:00
2015-01-09 15:44:23 +01:00
2014-11-24 16:13:16 +01:00
2015-05-31 18:06:28 -07:00
2013-06-26 18:32:47 -07:00
2015-03-09 10:45:26 -04:00
2014-11-20 09:11:10 +01:00
2015-02-02 09:57:45 -08:00
2014-11-24 20:01:40 +01:00
2013-11-26 11:09:07 +01:00
2014-11-12 11:19:41 +01:00
2015-08-26 16:28:48 -07:00
2015-08-26 16:29:49 -07:00
2015-08-26 16:28:15 -07:00
2015-08-12 13:14:57 -07:00
2015-08-12 13:14:57 -07:00
2015-05-31 18:06:28 -07:00
2015-02-02 09:57:46 -08:00
2015-05-31 18:06:28 -07:00
2015-08-28 13:14:53 -07:00
2015-07-30 12:41:47 -07:00
2015-06-02 17:24:54 -07:00
2014-03-15 10:19:19 -07:00
2014-11-24 14:45:27 +01:00
2014-04-11 16:15:36 -04:00
2014-10-20 16:21:33 +02:00
2015-07-30 21:02:01 -07:00
2014-03-15 10:19:18 -07:00
2014-11-24 14:45:27 +01:00
2015-05-31 18:06:28 -07:00
2014-10-20 16:21:33 +02:00
2015-03-09 07:18:14 -04:00
2015-08-28 13:14:56 -07:00
2015-08-26 07:23:04 -07:00
2014-03-27 08:26:31 -07:00
2015-03-23 14:29:40 +11:00
2014-10-20 16:21:33 +02:00
2014-08-12 12:15:14 -06:00
2014-11-24 14:45:27 +01:00
2014-07-17 22:07:35 +02:00
2015-05-31 18:06:28 -07:00
2015-03-09 10:45:26 -04:00
2014-11-20 09:11:20 +01:00
2015-05-31 18:06:28 -07:00
2014-11-24 20:01:28 +01:00
2014-11-20 09:11:10 +01:00
2014-11-20 09:11:10 +01:00
2015-02-10 20:01:30 -08:00
2015-05-31 18:06:28 -07:00
2015-05-31 18:06:28 -07:00
2015-05-31 18:06:28 -07:00
2015-05-31 18:06:28 -07:00
2015-05-31 18:06:28 -07:00
2015-06-01 07:32:43 -07:00
2015-09-06 11:03:14 -07:00
2015-04-27 09:38:06 -07:00
2015-08-28 13:14:58 -07:00
2015-09-06 12:05:45 -07:00
2014-11-12 11:16:12 +01:00
2015-08-28 13:14:57 -07:00
2015-02-04 08:00:24 -08:00
2014-11-12 11:16:05 +01:00
2014-04-24 13:44:54 -04:00
2014-12-15 15:11:06 +01:00
2015-08-28 13:14:56 -07:00
2015-02-02 09:57:46 -08:00
2015-06-01 07:32:43 -07:00
2014-06-06 16:08:16 -07:00
2015-08-28 13:14:56 -07:00
2015-02-02 09:57:46 -08:00
2015-04-10 07:40:32 -07:00
2015-07-30 12:43:00 -07:00
2015-09-06 11:13:41 -07:00
2014-12-04 09:58:33 +01:00
2015-05-18 13:35:55 -04:00
2015-06-01 07:32:43 -07:00
2014-11-12 11:15:54 +01:00
2015-04-16 10:37:12 -07:00
2015-05-25 08:46:24 -07:00
2014-11-12 11:15:57 +01:00
2015-01-09 15:44:19 +01:00
2015-04-11 22:27:14 -04:00
2014-10-20 16:21:33 +02:00
2014-10-20 16:21:33 +02:00
2015-01-20 19:43:24 +01:00
2014-07-17 22:07:39 +02:00
2014-11-24 20:01:28 +01:00
2014-11-12 11:15:57 +01:00
2015-08-26 07:45:25 -07:00
2015-06-02 08:03:25 -07:00
2014-11-12 11:19:44 +01:00
2015-08-26 22:41:36 -07:00
2014-05-28 12:16:28 +02:00
2015-03-09 07:18:14 -04:00
2014-11-20 09:11:15 +01:00
2014-10-20 16:21:33 +02:00
2014-10-20 16:21:33 +02:00
2015-05-31 18:06:28 -07:00
2014-11-20 09:11:10 +01:00
2014-11-20 09:11:10 +01:00
2014-11-24 14:45:27 +01:00
2015-05-25 09:14:47 -07:00
2014-11-24 14:45:28 +01:00
2014-09-24 11:52:09 -06:00
2015-02-02 09:57:46 -08:00
2015-05-31 18:06:28 -07:00
2015-05-31 18:06:28 -07:00
2015-02-02 09:57:45 -08:00
2015-04-15 10:56:47 +01:00
2013-11-26 11:09:07 +01:00