Re: [PATCH] blk-throttle: fix race between submitter and throttler thread

From: Tejun Heo
Date: Thu May 20 2021 - 11:00:42 EST


Hello, Dmitry.

This generally looks good to me. A couple nits below.

> @@ -277,6 +277,8 @@ static struct bio *__bio_chain_endio(struct bio *bio)
> {
> struct bio *parent = bio->bi_private;
>
> + BUG_ON(!bio_flagged(parent, BIO_CHAIN));

Let's do WARN_ON_ONCE().

> @@ -2270,6 +2285,8 @@ bool blk_throtl_bio(struct bio *bio)
>
> td->nr_queued[rw]++;
> throtl_add_bio_tg(bio, qn, tg);

Can you add some comment here explaining how now that the bio is added for
throttling, there are two accessors of it and the bio must not be modified
without holding the lock?

Thank you.

--
tejun