linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: avoid a permanent stop of the scsi device's request queue
@ 2016-12-06  9:12 Wei Fang
  2016-12-06 15:51 ` Bart Van Assche
  0 siblings, 1 reply; 22+ messages in thread
From: Wei Fang @ 2016-12-06  9:12 UTC (permalink / raw)
  To: jejb, martin.petersen; +Cc: linux-scsi, tyasui, Wei Fang

A scan work can run simultaneously with fc_remote_port_delete().
If a scsi device is added to the ->__devices list in the scan work,
it can be touched and will be blocked in scsi_target_block(), which
will be called in fc_remote_port_delete(), and QUEUE_FLAG_STOPPED
flag will be setted to the scsi device's request queue.

The scsi device is being setted to the SDEV_RUNNING state at the end of
the scan work. When the remote port reappears, scsi_target_unblock()
will be called, but the QUEUE_FLAG_STOPPED flag will not be cleared,
since scsi_internal_device_unblock() ignores SCSI devices in SDEV_RUNNING
state. It results in a permanent stop of the scsi device's request
queue. Every requests sended to it will be blocked.

It looks like it's a regression caused by:
commit 5c10e63c943b
("[SCSI] limit state transitions in scsi_internal_device_unblock")

Fix this by restarting the device queue if the state is SDEV_RUNNING.

Reported-by: Zengxi Chen <chenzengxi@huawei.com>
Signed-off-by: Wei Fang <fangwei1@huawei.com>
---
 drivers/scsi/scsi_lib.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 9ca1f17..253ee74 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2942,7 +2942,8 @@ scsi_internal_device_unblock(struct scsi_device *sdev,
 		else
 			sdev->sdev_state = SDEV_CREATED;
 	} else if (sdev->sdev_state != SDEV_CANCEL &&
-		 sdev->sdev_state != SDEV_OFFLINE)
+		 sdev->sdev_state != SDEV_OFFLINE &&
+		 sdev->sdev_state != SDEV_RUNNING)
 		return -EINVAL;
 
 	if (q->mq_ops) {
-- 
2.4.11


^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2016-12-09  1:09 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-06  9:12 [PATCH] scsi: avoid a permanent stop of the scsi device's request queue Wei Fang
2016-12-06 15:51 ` Bart Van Assche
2016-12-07  1:20   ` Wei Fang
2016-12-07  2:45     ` Bart Van Assche
2016-12-07  3:41       ` Wei Fang
2016-12-07  4:40         ` Bart Van Assche
2016-12-07  6:59           ` Wei Fang
2016-12-07 16:48             ` Bart Van Assche
2016-12-07 16:55               ` Bart Van Assche
2016-12-07 17:40                 ` Ewan D. Milne
2016-12-07 18:16                   ` James Bottomley
2016-12-07 19:24                     ` Ewan D. Milne
2016-12-07 20:09                       ` James Bottomley
2016-12-07 20:30                         ` Ewan D. Milne
2016-12-07 23:43                           ` James Bottomley
2016-12-08  2:28                             ` Wei Fang
2016-12-08  2:33                               ` James Bottomley
2016-12-08  3:22                                 ` Wei Fang
2016-12-08  6:38                                   ` Wei Fang
2016-12-08 14:04                                     ` Ewan D. Milne
2016-12-08 15:39                                   ` James Bottomley
2016-12-09  1:08                                     ` Wei Fang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).