From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:55436 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725913AbeKUL4u (ORCPT ); Wed, 21 Nov 2018 06:56:50 -0500 Date: Wed, 21 Nov 2018 09:24:34 +0800 From: Ming Lei To: Damien Le Moal Cc: Jens Axboe , "linux-block@vger.kernel.org" , Adam Manzanares , Alexander Viro , "linux-fsdevel@vger.kernel.org" Subject: Re: [PATCH 2/7] block: Remove bio->bi_ioc Message-ID: <20181121012433.GD31748@ming.t460p> References: <20181119035131.11255-1-damien.lemoal@wdc.com> <20181119035131.11255-3-damien.lemoal@wdc.com> <20181120172126.GA28169@ming.t460p> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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, Ming