On 2018/11/21 10:24, Ming Lei wrote:
> On Tue, Nov 20, 2018 at 11:58:09PM +0000, Damien Le Moal wrote:
>> On 2018/11/21 2:31, Jens Axboe wrote:
>>> I think the below should fix it, we haven't necessarily setup an
>>> ioc if we're just doing as passthrough request.
>>>
>>>
>>> diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
>>> index 13b8dc332541..f096d8989773 100644
>>> --- a/block/blk-mq-sched.c
>>> +++ b/block/blk-mq-sched.c
>>> @@ -34,9 +34,16 @@ EXPORT_SYMBOL_GPL(blk_mq_sched_free_hctx_data);
>>> void blk_mq_sched_assign_ioc(struct request *rq)
>>> {
>>> struct request_queue *q = rq->q;
>>> - struct io_context *ioc = current->io_context;
>>> + struct io_context *ioc;
>>> struct io_cq *icq;
>>>
>>> + /*
>>> + * May not have an IO context if it's a passthrough request
>>> + */
>>> + ioc = current->io_context;
>>> + if (!ioc)
>>> + return;
>>> +
>>> spin_lock_irq(&q->queue_lock);
>>> icq = ioc_lookup_icq(ioc, q);
>>> spin_unlock_irq(&q->queue_lock);
>>
>> This seems reasonable to me, but I wonder why this problem was not triggering
>> before. The previous code getting the ioc with the rq_ioc(bio) call was
>> essentially the same and there was no "if (!ioc) return;" in
>> blk_mq_sched_assign_ioc() before the patch.
>> Any idea why this is popping up now ?
>>
>> Ming,
>>
>> Is this a new test your are running ? If this same problem triggers on stable
>> kernels, Jens patch needs to go to stable too.
>
> No, I run daily block related tests on block for-next, and this issue is
> just triggered when your patches landed.
>
> You may find the test script:
>
> https://people.redhat.com/minlei/tests/tools/elv-switch
Thanks for the information. I will look into what else caused the behavior
change.
--
Damien Le Moal
Western Digital Research