linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Garry <john.g.garry@oracle.com>
To: Zhang Yi <yi.zhang@huaweicloud.com>,
	linux-block@vger.kernel.org, linux-raid@vger.kernel.org,
	drbd-dev@lists.linbit.com
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	hch@lst.de, martin.petersen@oracle.com, axboe@kernel.dk,
	yi.zhang@huawei.com, yukuai3@huawei.com, yangerkun@huawei.com
Subject: Re: [PATCH 1/2] md: init queue_limits->max_hw_wzeroes_unmap_sectors parameter
Date: Tue, 2 Sep 2025 13:25:39 +0100	[thread overview]
Message-ID: <5b0fd2a0-dffc-4f51-bdff-746e9bd611bd@oracle.com> (raw)
In-Reply-To: <20250825083320.797165-2-yi.zhang@huaweicloud.com>

On 25/08/2025 09:33, Zhang Yi wrote:
> From: Zhang Yi <yi.zhang@huawei.com>
> 
> The parameter max_hw_wzeroes_unmap_sectors in queue_limits should be
> equal to max_write_zeroes_sectors if it is set to a non-zero value.
> However, the stacked md drivers call md_init_stacking_limits() to
> initialize this parameter to UINT_MAX but only adjust
> max_write_zeroes_sectors when setting limits. Therefore, this
> discrepancy triggers a value check failure in blk_validate_limits().
> 
> Fix this failure by explicitly setting max_hw_wzeroes_unmap_sectors to
> zero.
> 
> Fixes: 0c40d7cb5ef3 ("block: introduce max_{hw|user}_wzeroes_unmap_sectors to queue limits")
> Reported-by: John Garry <john.g.garry@oracle.com>
> Closes: https://lore.kernel.org/linux-block/803a2183-a0bb-4b7a-92f1-afc5097630d2@oracle.com/
> Signed-off-by: Zhang Yi <yi.zhang@huawei.com>

Tested-by: John Garry <john.g.garry@oracle.com> # raid 0/1/10

> diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
> index f1d8811a542a..419139ad7663 100644
> --- a/drivers/md/raid0.c
> +++ b/drivers/md/raid0.c
> @@ -382,6 +382,7 @@ static int raid0_set_limits(struct mddev *mddev)
>   	md_init_stacking_limits(&lim);
>   	lim.max_hw_sectors = mddev->chunk_sectors;
>   	lim.max_write_zeroes_sectors = mddev->chunk_sectors;
> +	lim.max_hw_wzeroes_unmap_sectors = mddev->chunk_sectors;
>   	lim.io_min = mddev->chunk_sectors << 9;
>   	lim.io_opt = lim.io_min * mddev->raid_disks;
>   	lim.chunk_sectors = mddev->chunk_sectors;
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index 408c26398321..35c6498b4917 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -3211,6 +3211,7 @@ static int raid1_set_limits(struct mddev *mddev)
>   
>   	md_init_stacking_limits(&lim);
>   	lim.max_write_zeroes_sectors = 0;
> +	lim.max_hw_wzeroes_unmap_sectors = 0;

It would be better if we documented why we cannot support this on 
raid1/10, yet we can on raid0.

I am looking through the history of why max_write_zeroes_sectors is set 
to zero. I have gone as far back as 5026d7a9b, and this tells us that 
the retry mechanism for WRITE SAME causes an issue where mirrors are 
offlined (and so we disabled the support); and this was simply copied 
for write zeroes in 3deff1a70.


  parent reply	other threads:[~2025-09-02 12:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-25  8:33 [PATCH 0/2] Fix the initialization of max_hw_wzeroes_unmap_sectors for stacking drivers Zhang Yi
2025-08-25  8:33 ` [PATCH 1/2] md: init queue_limits->max_hw_wzeroes_unmap_sectors parameter Zhang Yi
2025-08-25  8:52   ` Li Nan
2025-08-25  8:59   ` Paul Menzel
2025-08-25 11:25     ` Zhang Yi
2025-09-02 12:25   ` John Garry [this message]
2025-08-25  8:33 ` [PATCH 2/2] drbd: " Zhang Yi
2025-08-25 19:54 ` [PATCH 0/2] Fix the initialization of max_hw_wzeroes_unmap_sectors for stacking drivers Martin K. Petersen
2025-08-26  0:44 ` Yu Kuai

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=5b0fd2a0-dffc-4f51-bdff-746e9bd611bd@oracle.com \
    --to=john.g.garry@oracle.com \
    --cc=axboe@kernel.dk \
    --cc=drbd-dev@lists.linbit.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=yi.zhang@huaweicloud.com \
    --cc=yukuai3@huawei.com \
    /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;
as well as URLs for NNTP newsgroup(s).