public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	dm-devel@lists.linux.dev, Mike Snitzer <snitzer@kernel.org>,
	Bart Van Assche <bvanassche@acm.org>
Subject: Re: [PATCH v2 3/4] dm: dm-crypt: Do not split write operations with zoned targets
Date: Wed, 25 Jun 2025 23:43:28 +0900	[thread overview]
Message-ID: <40690cc0-e941-4db1-904c-a5d60718d852@kernel.org> (raw)
In-Reply-To: <5c9898e1-3fae-d271-b0b8-a23371d22cb0@redhat.com>

On 6/25/25 23:03, Mikulas Patocka wrote:
> 
> 
> On Wed, 25 Jun 2025, Damien Le Moal wrote:
> 
>> On 6/25/25 19:19, Mikulas Patocka wrote:
>>>
>>>
>>> On Wed, 25 Jun 2025, Damien Le Moal wrote:
>>>
>>>> +	bool wrt = op_is_write(bio_op(bio));
>>>> +
>>>> +	if (wrt) {
>>>> +		/*
>>>> +		 * For zoned devices, splitting write operations creates the
>>>> +		 * risk of deadlocking queue freeze operations with zone write
>>>> +		 * plugging BIO work when the reminder of a split BIO is
>>>> +		 * issued. So always allow the entire BIO to proceed.
>>>> +		 */
>>>> +		if (ti->emulate_zone_append)
>>>> +			return bio_sectors(bio);
>>>
>>> The overrun may still happen (if the user changes the dm table while some 
>>> bio is in progress) and if it happens, you should terminate the bio with 
>>> DM_MAPIO_KILL (like it was in my original patch).
>>
>> I am confused... Overrun against what ? We are now completely ignoring the
>> max_write_size limit so even if the user changes it, that will not affect the
>> BIO processing. If you are referring to an overrun against the zoned device
>> max_hw_sectors limit, it is not possible since changing limits is done with the
>> DM device queue frozen, so we are guaranteed that there will be no BIO in-flight.
>>
>> I am not sure about what kind of table change you are thinking of, but at the
>> very least,  dm_table_supports_size_change() ensure that there cannot be any
>> device size change for a zoned DM device. And given the above point about limits
>> changes, I do not see how a table change can affect the BIO execution.
>>
>> Do you have a specific example in mind ?
> 
> What happens if a bio that is larger than "BIO_MAX_VECS << PAGE_SHIFT" 
> enters dm_split_and_process_bio? Where will the bio be split? I don't see 
> it, but maybe I'm missing something.

See patch 3 of the v3 I sent: dm_zone_bio_needs_split() and
dm_split_and_process_bio() have been modified to always endup with need_split ==
true for zone write BIOs, and that causes a call to bio_split_to_limits(). So
dm-crypt will always see BIOs that are smaller than limits->max_hw_sectors,
which is set to BIO_MAX_VECS << PAGE_SECTORS_SHIFT in dm-crypt io_hint. So
dm-crypt can never see a write BIO that is larger than BIO_MAX_VECS << PAGE_SHIFT.


> 
> Mikulas
> 


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2025-06-25 14:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-25  5:59 [PATCH v2 0/4] Fix write operation handling for zoned DM devices Damien Le Moal
2025-06-25  5:59 ` [PATCH v2 1/4] block: Introduce bio_needs_zone_write_plugging() Damien Le Moal
2025-06-25  6:12   ` Christoph Hellwig
2025-06-25  6:14     ` Damien Le Moal
2025-06-25  6:18       ` Christoph Hellwig
2025-06-25  6:17         ` Damien Le Moal
2025-06-25  5:59 ` [PATCH v2 2/4] dm: Always split write BIOs to zoned device limits Damien Le Moal
2025-06-25  6:15   ` Christoph Hellwig
2025-06-25  6:15     ` Damien Le Moal
2025-06-25  5:59 ` [PATCH v2 3/4] dm: dm-crypt: Do not split write operations with zoned targets Damien Le Moal
2025-06-25 10:19   ` Mikulas Patocka
2025-06-25 12:54     ` Damien Le Moal
2025-06-25 14:03       ` Mikulas Patocka
2025-06-25 14:43         ` Damien Le Moal [this message]
2025-06-25 16:33           ` Mikulas Patocka
2025-06-25  5:59 ` [PATCH v2 4/4] dm: Check for forbidden splitting of zone write operations Damien Le Moal
2025-06-25  6:16   ` Christoph Hellwig

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=40690cc0-e941-4db1-904c-a5d60718d852@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=dm-devel@lists.linux.dev \
    --cc=linux-block@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox