[lkml]   [2019]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 0/8]: blk-mq: use static_rqs to iterate busy tags

On 3/15/19 5:20 PM, Christoph Hellwig wrote:
> On Fri, Mar 15, 2019 at 04:57:36PM +0800, Jianchao Wang wrote:
>> Hi Jens
>> As we know, there is a risk of accesing stale requests when iterate
>> in-flight requests with tags->rqs[] and this has been talked in following
>> thread,
>> [1]
>> [2]
> I'd rather take one step back and figure out why we are iterating
> the busy requests. There really shouldn't be any reason why a driver
> is even doings that (vs some error handling helpers in the core
> block code that can properly synchronize).

A typical scene is blk_mq_in_flight,

blk_mq_get_request blk_mq_in_flight
-> blk_mq_get_tag -> blk_mq_queue_tag_busy_iter
-> bt_for_each
-> bt_iter
-> rq = taags->rqs[]
-> rq->q //---> get a stale request
-> blk_mq_rq_ctx_init
-> data->hctx->tags->rqs[rq->tag] = rq

This stale request maybe something that has been freed due to io scheduler
is detached or a q using a shared tagset is gone.

And also the blk_mq_timeout_work could use it to pick up the expired request.
The driver would also use it to requeue the in-flight requests when the device is dead.

Compared with adding more synchronization, using static_rqs[] directly maybe simpler :)


 \ /
  Last update: 2019-03-15 10:43    [W:0.285 / U:5.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site