[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACVXFVOsHO28yTQN8uPgOgtrTjrs52Le01wChxdYyjeBr0ZcOQ@mail.gmail.com>
Date: Thu, 18 Sep 2014 09:33:35 +0800
From: Ming Lei <ming.lei@...onical.com>
To: Christoph Hellwig <hch@....de>
Cc: Jens Axboe <axboe@...nel.dk>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Ming Lei <ming.lei@...oical.com>
Subject: Re: [PATCH 2/2] blk-mq: remove unnecessary blk_clear_rq_complete()
On Thu, Sep 18, 2014 at 12:48 AM, Christoph Hellwig <hch@....de> wrote:
> On Wed, Sep 17, 2014 at 05:47:58PM +0800, Ming Lei wrote:
>> From: Ming Lei <ming.lei@...oical.com>
>>
>> This patch removes two unnecessary blk_clear_rq_complete(),
>> the REQ_ATOM_COMPLETE flag is cleared inside blk_mq_start_request(),
>> so:
>>
>> - The blk_clear_rq_complete() in blk_flush_restore_request()
>> needn't because the request will be freed later, and clearing
>> it here may open a small race window with timeout.
>
> This one is defintively correct, blk_mq_end_io should take care of this.
>
>> - The blk_clear_rq_complete() in blk_mq_requeue_request() isn't
>> necessary too, even though REQ_ATOM_STARTED is cleared in
>> __blk_mq_requeue_request(), in theory it still may cause a small
>> race window with timeout since the two clear_bit() may be
>> reordered.
>
> Why yo you think it's not nessecary? The request is not in the drivers
The COMPLETED flag will be cleared in blk_mq_start_request(), so
it needn't to be cleared here, and it is a bit early and might cause
a tiny race window.
> hand at this point, so it should not be marked started. Maybe I'm missing
> something, but this sounds like it could very likely cause regressions.
The STARTED flag has been cleared in __blk_mq_requeue_request(),
I mean the COMPLETED flag, consider the following situation:
- one req is queued to driver, and the req is completed from
the device just before its timeout expired
- the driver checks the result and finds it need to requeue for some reason
- blk_mq_requeue_request() is called to requeue the req
- COMPLETED is cleared before clearing STARTED because of
writes reorder
- timeout just comes between the two writes
- then the request may be completed another time because of timeout
Thanks,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists