From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.174 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795980336; b=dAWsHagWABwpNKmhUvBuWmyr0TTkRG6XqD54V4ZpBe/9ll9vqK0B/t7kUDenSFLfZMlV sDf8zubrbUZgr/hkPeYXIBkRuA9CxChwvkkoXirdCSZYpFScIOrV5GR3Xtnypcy6O6U1H R6bipfgsZzkFkeaaNY8nRluKq+Q0DnR8DogdW3YSpH7TQv6NIcUKsyO0C4tC3udEGinoQ 2MAovzHXDJUVNLygkgF4PJT9rOlZQX3x1vJcSGCSN2sIT2n4vg8XCa7Wjd3WfE4rplqx5 J6ynVPfzh9/z1sMtFGyEAYERgBsBOjtQevDaOj6ZWFA5OdJTJ0lnEy6OqXy8lbRhytw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795980336; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:In-Reply-To:References:Message-ID: MIME-Version:Content-Type:Content-Disposition:User-Agent; bh=K3Qr1N50Ax4p75coI51Dwnb3VxgdIFUbpUzOuOpSClA=; b=udWmCd1uNxRnpgkgIUp7HEOnNnxU40zv2UdP/mv2+lCJRH5F879yNq7FTFL7whCE0aA7 DB4+xylFdYkVktBh9sk3Xj3D+EMs4+r30jMWtoCcSSLCTsv7HEsoFHl2z8HLaRNGtIDr2 55J0MBlbtPFP+2WLRleht+GqLpiMWvSccZEWwPnKPuF34u3QvHvSJlIBumj02n1g9H9EF 1qVUbb3AFqFUx/vP5a6iGW954QIWYlnq1l1Kbc7DuNgZnj+znn1C6kA6ViKdpZYvDeO+Y agcdoSXsscTp58tIkp1o4lo3uqW376rcyRhHHvHY7IDbacySncPiii+wyh3I6ZdbZRw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=chrisdown.name; spf=pass smtp.mailfrom=chrisdown.name; dkim=pass header.d=chrisdown.name header.i=@chrisdown.name header.a=rsa-sha256 header.s=google header.b=ANrE9gxD; arc=none smtp.remote-ip=209.85.128.174 Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F03D606A337 for ; Sun, 29 Nov 2026 19:25:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1F03D606A337 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=chrisdown.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chrisdown.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chrisdown.name header.i=@chrisdown.name header.a=rsa-sha256 header.s=google header.b=ANrE9gxD Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-8b4f4095a7aso84035257b3.0 for ; Sun, 29 Nov 2026 11:25:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; t=1795980335; x=1796585135; darn=vger.kernel.org; h=user-agent:content-disposition:content-type:mime-version:message-id :references:in-reply-to:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=K3Qr1N50Ax4p75coI51Dwnb3VxgdIFUbpUzOuOpSClA=; b=ANrE9gxD/uXHHgzDxzTR64JmBwIOUbTRaIN/LbfC4DxaUSKnThf2Rtj1HB7G9Eo9vt SphHEL8EiMASfHv6BGL36UrFLmPkSMverG5acF6parYigis8uccyvCEfyKD+S+G7lEz9 to0HUyoYeYAZYQkmG9rHchSNHJ2xeAaKqMOpg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795980335; x=1796585135; h=user-agent:content-disposition:content-type:mime-version:message-id :references:in-reply-to:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=K3Qr1N50Ax4p75coI51Dwnb3VxgdIFUbpUzOuOpSClA=; b=YrJvH5vhdq4SPvNMlhfVTPw7TKGniF7dQYO0l4uXhLVbrYgPRAa16h1+BVvutkygU5 YvR90HhckQJ5Cs+h/BgAuDwKnqYDtUTE2j/kbDSGC0pOqejs8rnHqJps60SDEt2AsodY f8wWWRn+D3ecvirj4Y+rOms9AuTARoDV21zE34VxJd1AhupasIvEtN7/7l6g1mvT43D3 z/PCgHmB9cICFuPXkT2LeKuge97zrE22efeAB/cp5WyH6dZgyDt1h9/g4k8gnVyShbA4 3wzlpkZbz69snAG0tNzxGEY3jLfCrFjlyx+rmQ5qwhJZEB8KsCE+5NNEg9QNIJ3PEbiE 8DTg== X-Forwarded-Encrypted: i=1; AL+hErGwjfYiFkLk/ZKaxsLUvp6/g+kmMZuT/kvqtRvJpnIMXN+bn2wVAy0+3eGZdYrEiVBrx2tIurY3icu5nzU=@vger.kernel.org X-Gm-Message-State: APuU4Z/niZfAU6z1N+PN97v6wXtCfwgw8WFC5lfvmvTqwhUNcCFRqVKI 4BFrzLr0uhGo/LjPLlFvD8HWjDtfkLdKWgDqjxV/aKDf5aEUoNCADZmPwVcGz1lqSpg= X-Gm-Gg: AZFdTZc8gwxZ6MSACFjKQpTjCJVqIGPXiIi8YbtPrpMpNcK+NvWKLsNPQ45INtva+q5 kL1Pdl1Xv5/DJvIvKGfEG88HHZalB1HTd5x72K3BpZsgPRpMC+zrBLw/MqrBNHytA8swmt6IPqa 84qGWsqTQRgV+bxt4v7zvxQtY++mjBDuFzcwIacF+ifbMnP940cXBxBi5hexzlFAi/3o4wlkWAr 01zazPZV5DkDtgTxXAYbLRUN94OGwEnrq74ItGdvWmUBLUAQW6QO2wQG9RLVRfwVfVxglMRGTk9 kwk38qY7ppgALl6Ulpn1/mjoQxOriFSM2ytKk0MKLnLbRoC7eyIVXRrx1VgxVtjOYqCWll1nJCT MY7VLflhEgEJtMMaZL+C1LNysb7GK3mJNzm2g3ueHyouzp7vnBKFMljy/pPl3QMX86Pb6ZQP281 nBpskv8+VKOUOewRV6+gUtMCgwTOjJ7CdlNy3te0M/JFN+ZhO6cIKw18FZwkA4reIjsIy0EM0i8 GXqoWO03WXihIIKMglxo0C1zG8eGaqrxLfVgLUC0xYX4KVgPGeBdXVy5XscrF1nr8UhAKYuIzEa j79m8YLInquPXdmb9Dv52UKhmf5nAwQ3SVNH65uEZTDqQKLVqjBQs+JAnIiQpYg5Z1QGdiQTor2 RQY1sxfd68ep3EE95UkxvA8RrFBMm6R1RSP7jokK+/RNjgbyovtegCrDtGIp06Wtr0um9INMDos pbYSEzjVVnjqLf5D9jV39W7q4fuvY5lHz3T73SRYifnfbMaW7bcKgETyDIop1HKDImk9JqyV2Wo t4oLR1KJrPu64ZBPSc+Rgn/ X-Received: by 2002:a05:690e:b8d:b0:679:cc49:55cb with SMTP id 956f58d0204a3-67df44b8ae6mr15104364d50.99.1795980335207; Sun, 29 Nov 2026 11:25:35 -0800 (PST) Received: from [172.20.0.2] (c-73-207-185-9.hsd1.ga.comcast.net. [73.207.185.9]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8b5201ba5c1sm120945437b3.3.2026.11.29.11.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 11:25:33 -0800 (PST) Date: Sun, 29 Nov 2026 11:25:32 -0800 From: Chris Down To: Bart Van Assche Cc: "Martin K. Petersen" , "James E.J. Bottomley" , Christoph Hellwig , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com Subject: Re: [PATCH v2 2/5] scsi: sd: Fix data corruption in WRITE SAME(10) write zeroes In-Reply-To: <79cccf57-7539-41c5-a4d0-dd71336f1111@acm.org> References: <79cccf57-7539-41c5-a4d0-dd71336f1111@acm.org> Message-ID: 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 User-Agent: Mutt/2.4.3 (cc9e3943) (2026-10-09) Hi Bart, Thanks for the detailed review! Much appreciated. Bart Van Assche writes: >(sector_t)U32_MAX + 1 is easier to read than `1 + (sector_t)0xffffffff`. Sure, I'll use that in v3. >If zeroing_mode_store() uses queue_limits_start_update() + >blk_mq_freeze_queue() + queue_limits_commit_update() + unfreeze (like >provisioning_mode_store()) and updates lim.max_hw_wzeroes_unmap_sectors, >it closes these races and fixes the stale unmap limit after sysfs >writes. Yeah, that makes sense, I'll do that in v3. The limit update fits in patch 1, and the check here moves under the limits lock. max_write_same_blocks_store() needs the same for your second case, since it sets max_ws_blocks before it takes the lock. With scsi_debug I can get v2 to send WRITE SAME(10) with a count of zero that way, so I'll change it together with the other stores in patch 4. Chris