Re: [PATCH] blk-mq: insert passthrough request into hctx->dispatch directly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 19, 2020 at 08:36:15AM -0800, Christoph Hellwig wrote:
> On Sat, Feb 15, 2020 at 11:21:40AM +0800, Ming Lei wrote:
> > For some reason, device may be in one situation which can't handle
> > FS request, so STS_RESOURCE is always returned and the FS request
> > will be added to hctx->dispatch. However passthrough request may
> > be required at that time for fixing the problem. If passthrough
> > request is added to scheduler queue, there isn't any chance for
> > blk-mq to dispatch it given we prioritize requests in hctx->dispatch.
> > Then the FS IO request may never be completed, and IO hang is caused.
> > 
> > So passthrough request has to be added to hctx->dispatch directly.
> > 
> > Fix this issue by inserting passthrough request into hctx->dispatch
> > directly. Then it becomes consistent with original legacy IO request
> > path, in which passthrough request is always added to q->queue_head.
> 
> Do you have a description of an actual problem this fixes?  Maybe even
> a reproducer for blktests?
> 

It is reported by one RH customer in the following test case:

	1) Start IO on Emulex FC host
	2) Fail one controller, wait 5 minutes
	3) Bring controller back online

When we trace the problem, it is found that FS request started in device_add_disk()
from scsi disk probe context stuck because scsi_queue_rq() always return
STS_BUSY via scsi_setup_fs_cmnd() -> alua_prep_fn().

The kernel ALUA state is TRANSITIONING at that time, so it is reasonable to see
BLK_TYPE_FS requests won't go anywhere because of the check in alua_prep_fn().

However, the passthrough request(TEST UNIT READY) is submitted from alua_rtpg_work
when the FS request can't be dispatched to LLD. And SCSI stack should
have been allowed to handle this passthrough rquest. But it can't reach SCSI stack
via .queue_rq() because blk-mq won't dispatch it until hctx->dispatch is
empty.

The legacy IO request code always added passthrough request into head of q->queue_head
directly instead of scheduler queue or sw queue, so no such issue.

So far not figured out one blktests test case, but the problem is real.

BTW, I just found we need the extra following change:

@@ -1301,7 +1301,7 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list,
                        q->mq_ops->commit_rqs(hctx);

                spin_lock(&hctx->lock);
-               list_splice_init(list, &hctx->dispatch);
+               list_splice_tail_init(list, &hctx->dispatch);
                spin_unlock(&hctx->lock);

Will post V2.


Thanks,
Ming




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux