Hi Martin, On Mon, Feb 01, 2021 at 05:33:52PM -0500, Martin K. Petersen wrote: > > Ming, > > > BTW, which tree are you based for applying this patchset? > > 5.12/scsi-queue > > > I apply the patchset against for-5.12/block, and run it on kvm with > > 'megasas' device(LSI MegaRAID SAS 1078), looks it works well, and not > > see the hang issue. > > I tried with for-5.12/block and it still breaks for me. Things work fine > up until: > > scsi: core: Replace sdev->device_busy with sbitmap > > After that patch is applied no disks are discovered on my SAS/FC hosts. I think the following patch should fix the issue, care to give a test? diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 7d9171e05b58..65807cac6228 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1266,7 +1266,10 @@ static inline int scsi_dev_queue_ready(struct request_queue *q, token = sbitmap_get(&sdev->budget_map); if (atomic_read(&sdev->device_blocked)) { - if (token >= 0) + if (token < 0) + goto out; + + if (scsi_device_busy(sdev) > 1) goto out_dec; /* @@ -1282,6 +1285,7 @@ static inline int scsi_dev_queue_ready(struct request_queue *q, out_dec: if (token >= 0) sbitmap_put(&sdev->budget_map, token); +out: return -1; } -- Ming