summaryrefslogtreecommitdiff
path: root/block/bounce.c
diff options
context:
space:
mode:
authorMing Lei <ming.lei@redhat.com>2021-05-11 18:22:35 +0300
committerJens Axboe <axboe@kernel.dk>2021-05-24 15:47:22 +0300
commitbd63141d585bef14f4caf111f6d0e27fe2300ec6 (patch)
tree18c509a0a1fb0b90746396b360a5b1e5b46bae37 /block/bounce.c
parent2e315dc07df009c3e29d6926871f62a30cfae394 (diff)
downloadlinux-bd63141d585bef14f4caf111f6d0e27fe2300ec6.tar.xz
blk-mq: clear stale request in tags->rq[] before freeing one request pool
refcount_inc_not_zero() in bt_tags_iter() still may read one freed request. Fix the issue by the following approach: 1) hold a per-tags spinlock when reading ->rqs[tag] and calling refcount_inc_not_zero in bt_tags_iter() 2) clearing stale request referred via ->rqs[tag] before freeing request pool, the per-tags spinlock is held for clearing stale ->rq[tag] So after we cleared stale requests, bt_tags_iter() won't observe freed request any more, also the clearing will wait for pending request reference. The idea of clearing ->rqs[] is borrowed from John Garry's previous patch and one recent David's patch. Tested-by: John Garry <john.garry@huawei.com> Reviewed-by: David Jeffery <djeffery@redhat.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20210511152236.763464-4-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/bounce.c')
0 files changed, 0 insertions, 0 deletions