[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1394051621530051@iva4-92c901fae84c.qloud-c.yandex.net>
Date: Thu, 20 May 2021 20:00:51 +0300
From: Dmitry Monakhov <dmtrmonakhov@...dex-team.ru>
To: Tejun Heo <tj@...nel.org>
Cc: linux-kernel@...r.kernel.org, axboe@...nel.dk
Subject: Re: [PATCH] blk-throttle: fix race between submitter and throttler thread
> 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().
If we hit this point when this mean that ->bio_end_io will be called for parent bio.
Which likely result in use-after-free for that bio and silent data corruption for bio's pages
So IMHO BUG_ON is more appropriate here. What do you think?
>
>> @@ -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?
Sound reasonable, will be back with updated comments.
>
> Thank you.
>
> --
> tejun
Powered by blists - more mailing lists