From: Hannes Reinecke <hare@suse.de>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-scsi@vger.kernel.org,
"Martin K. Petersen" <martin.petersen@oracle.com>,
James Bottomley <james.bottomley@hansenpartnership.com>,
Christoph Hellwig <hch@lst.de>,
linux-block@vger.kernel.org,
Hans Holmberg <hans.holmberg@wdc.com>,
Damien Le Moal <damien.lemoal@wdc.com>,
Hannes Reinecke <hare@suse.com>
Subject: Re: [PATCH 1/2] blk-mq: fixup request re-insert in blk_mq_try_issue_list_directly()
Date: Fri, 20 Sep 2019 08:42:01 +0200 [thread overview]
Message-ID: <d435559e-806d-3828-e2be-9dde952d39f6@suse.de> (raw)
In-Reply-To: <20190919141934.GA11207@ming.t460p>
On 9/19/19 4:19 PM, Ming Lei wrote:
> On Thu, Sep 19, 2019 at 11:45:46AM +0200, Hannes Reinecke wrote:
>> From: Hannes Reinecke <hare@suse.com>
>>
>> When blk_mq_request_issue_directly() returns BLK_STS_RESOURCE we
>> need to requeue the I/O, but adding it to the global request list
>> will mess up with the passed-in request list. So re-add the request
>
> We always add request to hctx->dispatch_list after .queue_rq() returns
> BLK_STS_RESOURCE or BLK_STS_DEV_RESOURCE, so what is the messing up?
>
>> to the original list and leave it to the caller to handle situations
>> where the list wasn't completely emptied.
>>
>> Signed-off-by: Hannes Reinecke <hare@suse.com>
>> ---
>> block/blk-mq.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/block/blk-mq.c b/block/blk-mq.c
>> index b038ec680e84..44ff3c1442a4 100644
>> --- a/block/blk-mq.c
>> +++ b/block/blk-mq.c
>> @@ -1899,8 +1899,7 @@ void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,
>> if (ret != BLK_STS_OK) {
>> if (ret == BLK_STS_RESOURCE ||
>> ret == BLK_STS_DEV_RESOURCE) {
>> - blk_mq_request_bypass_insert(rq,
>> - list_empty(list));
>> + list_add(list, &rq->queuelist);
>
> This way may let this request(DONTPREP set) to be merged with other rq
> or bio, and potential data corruption may be caused, please see commit:
>
> c616cbee97ae blk-mq: punt failed direct issue to dispatch list
>
Ok.
What triggered this patch is this code:
insert:
if (bypass_insert)
return BLK_STS_RESOURCE;
blk_mq_request_bypass_insert(rq, run_queue);
return BLK_STS_OK;
}
static void blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx,
struct request *rq, blk_qc_t *cookie)
{
blk_status_t ret;
int srcu_idx;
might_sleep_if(hctx->flags & BLK_MQ_F_BLOCKING);
hctx_lock(hctx, &srcu_idx);
ret = __blk_mq_try_issue_directly(hctx, rq, cookie, false, true);
if (ret == BLK_STS_RESOURCE || ret == BLK_STS_DEV_RESOURCE)
blk_mq_request_bypass_insert(rq, true);
IE blk_mq_request_bypass_insert() will be called always once we hit the
'insert' label, the only difference being the second parameter of that
function.
I'd rather have the sequence consolidated, preferably by calling
blk_mq_request_bypass_insert() in one place only, and not scatter the
calls all over the code.
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@suse.de +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 247165 (AG München), GF: Felix Imendörffer
next prev parent reply other threads:[~2019-09-20 6:42 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-19 9:45 [RFC PATCH 0/2] blk-mq I/O scheduling fixes Hannes Reinecke
2019-09-19 9:45 ` [PATCH 1/2] blk-mq: fixup request re-insert in blk_mq_try_issue_list_directly() Hannes Reinecke
2019-09-19 14:19 ` Ming Lei
2019-09-20 6:42 ` Hannes Reinecke [this message]
2019-09-19 14:52 ` Guoqing Jiang
2019-09-19 9:45 ` [PATCH 2/2] blk-mq: always call into the scheduler in blk_mq_make_request() Hannes Reinecke
2019-09-19 10:21 ` Damien Le Moal
2019-09-19 14:23 ` Ming Lei
2019-09-19 15:48 ` Kashyap Desai
2019-09-19 16:13 ` Damien Le Moal
2019-09-21 15:26 ` [blk] b91f4a426e: fio.write_bw_MBps -9.3% regression kernel test robot
2019-09-19 9:56 ` [RFC PATCH 0/2] blk-mq I/O scheduling fixes Liu, Sunny
2019-09-19 10:03 ` Damien Le Moal
[not found] ` <BJXPR01MB0296594F3E478B5BFD4DA2ABF4890@BJXPR01MB0296.CHNPR01.prod.partner.outlook.cn>
2019-09-19 12:44 ` Damien Le Moal
2019-09-19 12:54 ` Liu, Sunny
2019-09-19 12:57 ` Hans Holmberg
2019-09-19 17:48 ` Jens Axboe
2019-09-19 21:11 ` Damien Le Moal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d435559e-806d-3828-e2be-9dde952d39f6@suse.de \
--to=hare@suse.de \
--cc=axboe@kernel.dk \
--cc=damien.lemoal@wdc.com \
--cc=hans.holmberg@wdc.com \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=ming.lei@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox