]> www.infradead.org Git - users/jedix/linux-maple.git/commit
scsi: avoid a permanent stop of the scsi device's request queue
authorWei Fang <fangwei1@huawei.com>
Tue, 13 Dec 2016 01:25:21 +0000 (09:25 +0800)
committerJack Vogel <jack.vogel@oracle.com>
Fri, 16 Feb 2018 23:05:55 +0000 (15:05 -0800)
commit486ab5e544f593baad7db71894f055d0c3e58a62
tree0b4431fee37ee52147aef6ccc78ae572c8eebee4
parent61920a6db770a6e1af7276fc16f306922fe6379c
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>
Orabug: 27546768
(cherry picked from commit d2a145252c52792bc59e4767b486b26c430af4bb)
Signed-off-by: Kyle Fortin <kyle.fortin@oracle.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_sysfs.c