Wei Fang d2a145252c scsi: avoid a permanent stop of the scsi device's request queue
A race between scanning and fc_remote_port_delete() may result in a
permanent stop if the device gets blocked before scsi_sysfs_add_sdev()
and unblocked after.  The reason is that blocking a device sets both the
SDEV_BLOCKED state and the QUEUE_FLAG_STOPPED.  However,
scsi_sysfs_add_sdev() unconditionally sets SDEV_RUNNING which causes the
device to be ignored by scsi_target_unblock() and thus never have its
QUEUE_FLAG_STOPPED cleared leading to a device which is apparently
running but has a stopped queue.

We actually have two places where SDEV_RUNNING is set: once in
scsi_add_lun() which respects the blocked flag and once in
scsi_sysfs_add_sdev() which doesn't.  Since the second set is entirely
spurious, simply remove it to fix the problem.

Cc: <stable@vger.kernel.org>
Reported-by: Zengxi Chen <chenzengxi@huawei.com>
Signed-off-by: Wei Fang <fangwei1@huawei.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2016-12-14 15:51:17 -05:00
..
2016-02-23 21:27:02 -05:00
2016-12-14 10:49:33 -08:00
2016-12-14 10:49:33 -08:00
2016-11-08 17:29:56 -05:00
2016-11-17 20:15:26 -05:00
2016-12-14 10:49:33 -08:00
2016-07-27 14:48:37 -07:00
2016-12-14 10:49:33 -08:00
2016-12-14 10:49:33 -08:00
2016-12-14 10:49:33 -08:00
2016-12-14 10:49:33 -08:00
2015-04-17 10:13:56 -07:00
2015-11-25 22:08:55 -05:00
2014-07-17 22:07:37 +02:00
2016-05-10 22:01:07 -04:00
2015-11-09 17:11:57 -08:00
2014-11-24 16:13:16 +01:00
2015-11-09 16:32:14 -08:00
2016-10-07 09:28:53 -07:00
2016-12-14 10:49:33 -08:00
2016-02-25 21:10:53 -05:00
2016-11-08 17:29:46 -05:00
2016-01-27 20:36:10 +08:00
2016-01-27 20:36:10 +08:00
2014-07-17 22:07:35 +02:00
2016-12-14 10:49:33 -08:00
2016-02-23 21:27:02 -05:00
2016-11-28 15:51:31 -05:00
2016-12-14 10:49:33 -08:00
2016-10-07 09:28:53 -07:00
2016-11-14 13:16:42 -07:00
2016-12-14 10:49:33 -08:00
2016-10-18 19:49:11 -06:00
2016-02-23 21:27:02 -05:00
2014-07-17 22:07:39 +02:00
2016-09-04 01:28:08 -04:00
2014-11-12 11:15:57 +01:00
2015-11-18 11:59:09 -05:00
2016-02-23 21:27:02 -05:00
2014-11-20 09:11:15 +01:00
2016-10-07 09:28:53 -07:00