lkml.org 
[lkml]   [2021]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH v3 1/3] blk-mq: Clean up references to old requests when freeing rqs
From
Date
On 3/5/21 7:14 AM, John Garry wrote:
> @@ -2296,10 +2296,14 @@ void blk_mq_free_rqs(struct blk_mq_tag_set *set, struct blk_mq_tags *tags,
>
> for (i = 0; i < tags->nr_tags; i++) {
> struct request *rq = tags->static_rqs[i];
> + int j;
>
> if (!rq)
> continue;
> set->ops->exit_request(set, rq, hctx_idx);
> + /* clean up any references which occur in @ref_tags */
> + for (j = 0; ref_tags && j < ref_tags->nr_tags; j++)
> + cmpxchg(&ref_tags->rqs[j], rq, 0);
> tags->static_rqs[i] = NULL;
> }
> }

What prevents blk_mq_tagset_busy_iter() from reading hctx->tags[...]
before the cmpxcg() call and dereferencing it after blk_mq_free_rqs()
has called __free_pages()?

Thanks,

Bart.

\
 
 \ /
  Last update: 2021-03-06 19:15    [W:0.174 / U:0.740 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site