From: Damien Le Moal <dlemoal@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org
Subject: Re: [PATCH v2 1/2] block: prevent freeing a zone write plug too early
Date: Tue, 23 Apr 2024 16:12:10 +1000 [thread overview]
Message-ID: <f5c36d0b-4d5a-47e2-8df1-66d3ee718ad2@kernel.org> (raw)
In-Reply-To: <ZiYCfTVpPqIMv8iE@infradead.org>
On 2024/04/22 16:23, Christoph Hellwig wrote:
> On Sat, Apr 20, 2024 at 04:58:10PM +0900, Damien Le Moal wrote:
>> Avoid this by calling flush_work() from disk_free_zone_wplug_rcu().
>
> Calling flush_work from a rcu callback is just asking for nasty
> deadlocks.
>
> What prevents you from just holding an extra zwplug reference while
> blk_zone_wplug_bio_work is running?
Problem is that this extra reference needs to be released in
blk_zone_wplug_bio_work(), before that function returns, and that is still the
work thread context using zwplug->bio_work. So we always have a small window
between the ref drop and the zone BIO work thread completing (context switch).
If we get a BIO completion in that window and free the plug, then the BIO work
struct may go away while the work thread is still referencing it.
Given that freeing of plugs will happen only after the RCU grace periods
elapses, I think this is all very unlikely to happen, but at the same time, I do
not see any guarantee that this cannot happen...
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2024-04-23 6:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-20 7:58 [PATCH v2 0/2] Fixes for zone write plugging Damien Le Moal
2024-04-20 7:58 ` [PATCH v2 1/2] block: prevent freeing a zone write plug too early Damien Le Moal
2024-04-22 6:23 ` Christoph Hellwig
2024-04-23 6:12 ` Damien Le Moal [this message]
2024-04-23 14:21 ` Jens Axboe
2024-04-23 15:16 ` Damien Le Moal
2024-04-23 15:36 ` Jens Axboe
2024-04-23 18:19 ` Damien Le Moal
2024-04-24 13:58 ` Jens Axboe
2024-04-20 7:58 ` [PATCH v2 2/2] block: use a per disk workqueue for zone write plugging Damien Le Moal
2024-04-22 6:25 ` Christoph Hellwig
2024-04-23 6:01 ` Damien Le Moal
2024-04-23 15:46 ` (subset) [PATCH v2 0/2] Fixes " Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f5c36d0b-4d5a-47e2-8df1-66d3ee718ad2@kernel.org \
--to=dlemoal@kernel.org \
--cc=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=linux-block@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox