From: Christoph Hellwig <hch@lst.de>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: dm-devel@lists.linux.dev, Mike Snitzer <snitzer@kernel.org>,
Mikulas Patocka <mpatocka@redhat.com>,
Christoph Hellwig <hch@lst.de>,
Benjamin Marzinski <bmarzins@redhat.com>
Subject: Re: [PATCH] dm-delay: Prevent zoned write reordering on suspend
Date: Thu, 10 Apr 2025 09:54:31 +0200 [thread overview]
Message-ID: <20250410075431.GA763@lst.de> (raw)
In-Reply-To: <20250410043311.990675-1-dlemoal@kernel.org>
On Thu, Apr 10, 2025 at 01:33:11PM +0900, Damien Le Moal wrote:
> When a dm-delay devie is being suspended, the .presuspend() operation is
s/devie/device/
> first executed (delay_presuspend()) to immediately issue all the BIOs
> present in the delayed list of the device and also sets the device
> may_delay boolean to false. At the same time, any new BIO is issued to
> the device will not be delayed and immediately issued with delay_bio()
> returning DM_MAPIO_REMAPPED. This creates a situation where potentially
> 2 different contexts may be issuing write BIOs to the same zone of a
> zone device without respecting the issuing order from the user, that is,
> a newly issued write BIO may be issued before other write BIOs for the
> same target zone that are in the device delayed list. If such situation
> occurs, write BIOs may be failed by the underlying zoned device due to
> an unaligned write error.
>
> Prevent this situation from happening by always handling newly issued
> write BIOs using the delayed list of BIOs, even when the device is being
> suspended. This is done by forcing the use of the worker kthread for
> zoned devices, and by modifying flush_worker_fn() to always flush all
> delayed BIOs if the device may_delay boolean is false.
Is that scenario specific to dm-delay? I think the same applies to
any other target that supports passing on bios to zoned devices.
> spin_lock(&dc->delayed_bios_lock);
> if (unlikely(!dc->may_delay)) {
> - spin_unlock(&dc->delayed_bios_lock);
> - return DM_MAPIO_REMAPPED;
> + /*
> + * Issue the BIO immediately if the device is not zoned. FOr a
> + * zoned device, preserver the ordering of write operations by
> + * using the delay list.
> + */
> + if (!bdev_is_zoned(c->dev->bdev) || c != &dc->write) {
> + spin_unlock(&dc->delayed_bios_lock);
> + return DM_MAPIO_REMAPPED;
Don't we only need to do that if anything is queued up due to a
suspension? Then again having a different patch might be premature
optimization, it's not like anyone cares about dm-delay performance
almost by definition :)
next prev parent reply other threads:[~2025-04-10 7:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-10 4:33 [PATCH] dm-delay: Prevent zoned write reordering on suspend Damien Le Moal
2025-04-10 4:43 ` Damien Le Moal
2025-04-10 7:54 ` Christoph Hellwig [this message]
2025-04-10 8:02 ` Damien Le Moal
2025-04-10 18:10 ` Benjamin Marzinski
2025-04-10 23:56 ` Damien Le Moal
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=20250410075431.GA763@lst.de \
--to=hch@lst.de \
--cc=bmarzins@redhat.com \
--cc=dlemoal@kernel.org \
--cc=dm-devel@lists.linux.dev \
--cc=mpatocka@redhat.com \
--cc=snitzer@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.