From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=213.95.11.211 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796030343; b=HC81Xv6JR5fbnJQOSjZr0NdN6cGO1/CI228dH5vUfMdroajq0ZWbzq9WjWrOIwKpw61E hKoqX+PDZGnWtM6kKzpI419s6cY96VxfpJWbfpqNJAFa4HsMR7nx/Rfg2R0z31/29IUMZ 2miqA+jXMDqS8J5pOTxKprtVmCsrIgfyLyYGlz8/IIMtu/qWYjwIEjkvB7l+3LD+FpiLk XssctocxPT9K8bFFvA7MRD0Tjn3hKgQgbTMpvL6xVM3v+sQN67pAPuWl1ukhCrTlkIlcw W1Ut3XY99VGu8ZYIzo6yHb8t32uXCShypBC/J82T/bUtyZJxS7HxzQqpUyjrYE2K+Fg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796030343; h=DMARC-Filter:Received:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent; bh=IzBl4vuDq/7ubFpyg5qQv0K8oWcAt8WasLL6SAt1STA=; b=CmCv5RU7eZuDejtIl+iV5Z2+gddHxe1pBxgXRxGJyUAB+Z2hLVMAK/K76kTkZvONcQ4P CaCGH9PsSVUL/LESn6MTs5BZ02W1MgjuWyhMPfoBVdaXKIHShqWKrVxfit5kbhozAciR/ Zjo5evsgpTsGvnGfCCh82xUE9ci9wTz9qOg3DO+thMgVW4ymJx2BOLd7Z1Of2K7FqooSo BdlaxSH9X0GmI0MVt1CX+0diIPQ8rArhBvzAaEviMsnk+c7p7G6iInCWiAuPf1crunjdH hEtHKLP8Y0Idbr+ja5IUAp1d+Glvjyh5mQkp33A7NygDXwCbiD6UW4EkddnNxJYr/hg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.remote-ip=213.95.11.211 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF5AA606A320; Mon, 30 Nov 2026 09:19:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CF5AA606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id 1386A68BEB; Mon, 30 Nov 2026 10:18:59 +0100 (CET) Date: Mon, 30 Nov 2026 10:18:58 +0100 From: Christoph Hellwig To: Chris Down Cc: "Martin K. Petersen" , "James E.J. Bottomley" , Christoph Hellwig , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, sashiko-bot@kernel.org, Bart Van Assche Subject: Re: [PATCH v3 3/5] scsi: sd: Fix data corruption in WRITE SAME(10) discards Message-ID: <20261130091858.GC12202@lst.de> References: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) On Sun, Nov 29, 2026 at 11:25:26AM -0800, Chris Down wrote: > We already cap the discard length in writesame_10 and writesame_zero > mode, but we still truncate the starting LBA to 32 bits. A discard at > or above block 2^32 can corrupt live data near the start of the disk > and still report success. > > The reason is that both modes send WRITE SAME(10), which only has a > 32-bit LBA. Given this, let's only select writesame_10 when a 32-bit > LBA can address the whole disk, and not accept either of them in > provisioning_mode for a bigger disk. This means that a bigger disk that > only reports LBPWS10 ends up with discard disabled. This commit log seems totally disconnect from that the patch does. > > Fixes: c98a0eb0e90d ("[SCSI] sd: Logical Block Provisioning update") > Cc: stable@vger.kernel.org > Signed-off-by: Chris Down > --- > drivers/scsi/sd.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c > index 26f40db3fd75..09cb64ca6db4 100644 > --- a/drivers/scsi/sd.c > +++ b/drivers/scsi/sd.c > @@ -616,6 +616,12 @@ provisioning_mode_store(struct device *dev, struct device_attribute *attr, > return -EINVAL; > > lim = queue_limits_start_update(sdkp->disk->queue); > + /* A revalidate can change the capacity, so check it under the lock. */ And this comment looks more than weird to. I think you'd be best of folding this into the previous patch and write your own commit logs and comments.