From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by mail19.linbit.com (LINBIT Mail Daemon) with ESMTP id 31E9C16228C for ; Wed, 10 Sep 2025 15:34:58 +0200 (CEST) Message-ID: <22b03d52-76c8-4ac6-96cf-830ec88eaef4@suse.de> Date: Wed, 10 Sep 2025 13:41:10 +0200 MIME-Version: 1.0 Subject: Re: [PATCH v2 1/2] md: init queue_limits->max_hw_wzeroes_unmap_sectors parameter To: Zhang Yi , linux-block@vger.kernel.org, linux-raid@vger.kernel.org, drbd-dev@lists.linbit.com References: <20250910111107.3247530-1-yi.zhang@huaweicloud.com> <20250910111107.3247530-2-yi.zhang@huaweicloud.com> Content-Language: en-US From: Hannes Reinecke In-Reply-To: <20250910111107.3247530-2-yi.zhang@huaweicloud.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Cc: axboe@kernel.dk, pmenzel@molgen.mpg.de, martin.petersen@oracle.com, john.g.garry@oracle.com, yangerkun@huawei.com, yi.zhang@huawei.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, yukuai3@huawei.com, hch@lst.de List-Id: "*Coordination* of development, patches, contributions -- *Questions* \(even to developers\) go to drbd-user, please." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On 9/10/25 13:11, Zhang Yi wrote: > From: Zhang Yi > > 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(). > > $ modprobe scsi_debug num_parts=2 dev_size_mb=8 lbprz=1 lbpws=1 > $ mdadm --create /dev/md0 --level=0 --raid-device=2 /dev/sda1 /dev/sda2 > mdadm: Defaulting to version 1.2 metadata > mdadm: RUN_ARRAY failed: Invalid argument > > Fix this failure by explicitly setting max_hw_wzeroes_unmap_sectors to > max_write_zeroes_sectors. Since the linear and raid0 drivers support > write zeroes, so they can support unmap write zeroes operation if all of > the backend devices support it. However, the raid1/10/5 drivers don't > support write zeroes, so we have to set it to zero. > > Fixes: 0c40d7cb5ef3 ("block: introduce max_{hw|user}_wzeroes_unmap_sectors to queue limits") > Reported-by: John Garry > Closes: https://lore.kernel.org/linux-block/803a2183-a0bb-4b7a-92f1-afc5097630d2@oracle.com/ > Signed-off-by: Zhang Yi > Tested-by: John Garry > Reviewed-by: Li Nan > Reviewed-by: Martin K. Petersen > Reviewed-by: Yu Kuai > --- > drivers/md/md-linear.c | 1 + > drivers/md/raid0.c | 1 + > drivers/md/raid1.c | 1 + > drivers/md/raid10.c | 1 + > drivers/md/raid5.c | 1 + > 5 files changed, 5 insertions(+) > Notice the failure, too. Thanks for fixing it. Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich