On Thu, Mar 28, 2019 at 09:42:51AM +0800, jianchao.wang wrote: > On 3/27/19 9:21 PM, Keith Busch wrote: > > +void blk_mq_terminate_queued_requests(struct request_queue *q, int hctx_idx) > > +{ > > + if (WARN_ON_ONCE(!atomic_read(&q->mq_freeze_depth))) > > + return; > > + if (WARN_ON_ONCE(!blk_queue_quiesced(q))) > > + return; > > + blk_sync_queue(q); > > + blk_mq_queue_tag_busy_iter(q, blk_mq_terminate_request, &hctx_idx); > > +} > > > Is it really OK to end these requests directly w/o dequeue ? > All of them are on ctx->rq_list, or hctx->dispatch list or internal queue of io scheduler. > > Terrible things may happen after we unquiesce the queue. Good point. This was intended as a last action before killing an hctx or the entire request queue, so I didn't expect they'd be turned back on, but it's easy enough to splice lists and handle those requests directly. We wouldn'even need to iterate tags that way, and may be better way to handle this.