From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4AB372DCBE3 for ; Sat, 26 Sep 2026 18:17:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790446632; cv=none; b=bJmTiie433RrL/dFT80GA5DSZ11/93YYji+hD0SuFAuEU2PyX6ynycg++9Px2dpiOF4D/wFoQ4Fa5WKRDH2h2R/bVwn9bbMHYD+qdP9faRKsZQxY68Ub2MQ3rKN/WCrelB9pe1c7Dhlb+Vo4C7Jiwb+3fOcGZYM1hnXxG+vJ6mU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790446632; c=relaxed/simple; bh=4SOu81yTRppMjmvYzStwz/4XSobf5kfsWdTXYk3JlgY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=orzSP8QUYFYw1Dqo051Y38Xk+6ziXkflfTN21h3HaEaumGTlkPTHn3x29M+C5lp4rJnOAijMb5xyaz8unyzIbOUQMxrgbuq4EfPSoWgypJCs7GIK5DNYKBB8gTqgRhxQr6QidfHIV8u5iubB1dZGEG4xhuYAhWtsHoxvjoyTYwY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Gs8R+qtN; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Gs8R+qtN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 935D61F00893; Sat, 26 Sep 2026 18:17:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1790446631; bh=ey0gyz67TSo2myMlN7dPMXp4he7umj2+wNfXxNtkXX8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Gs8R+qtNQf757gw6F7I5xYtDJSaExvUor1fOh9uL0N7qrx/zUVQnM5mI/QS6szuqD IJowLIYKkUQalEDBw0nd/WbXXLVmH00ycyP3D/iEpi7gNE++Bma0V5xgpuOwC2Z6dr sq6WRX/UAIl6hFQh/DYv8Ba97XzQX5UAl1k5VTY90AY0Gm4VmCsoFvt7dOq0LbTL/s McV5ZKvDIwybCY+SDkefBVEcqZtmKiOwk/Kh0IiyzxRo/YYfwzz6xh2AnqyExZfFFt m3lf8uX2tsv3ho+Ck6+zya7nxbxmR/d5jgHaM/nEDrMxZHzYfKIWl8lNalIrr7opIh xNN3HXDBO5c0g== From: Niklas Cassel To: "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, Damien Le Moal , John Garry , Niklas Cassel Subject: [PATCH v8 01/11] scsi: scsi_debug: Refuse a zoned device with a non-zero lowest aligned LBA Date: Sat, 26 Sep 2026 20:17:04 +0200 Message-ID: <20260926181702.508975-14-cassel@kernel.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260926181702.508975-13-cassel@kernel.org> References: <20260926181702.508975-13-cassel@kernel.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1627; i=cassel@kernel.org; h=from:subject; bh=4SOu81yTRppMjmvYzStwz/4XSobf5kfsWdTXYk3JlgY=; b=owGbwMvMwCV2MsVw8cxjvkWMp9WSGLJ28MjZnT5taLC3spZB+vwd/vyTYkdlXdmV7sy8YqhTs +GekExbRykLgxgXg6yYIovvD5f9xd3uU44r3rGBmcPKBDKEgYtTACYSqMnwPz9Hb9sLqZeFP/Ka b+/dsMy8aFqjbmT7o6pgp/9tG5e3XmH477vhZcOpuE/hyVemv3rIKt3osGNmBMtDhk0Nv1dtXZz wmh0A X-Developer-Key: i=cassel@kernel.org; a=openpgp; fpr=5ADE635C0E631CBBD5BE065A352FE6582ED9B5DA Content-Transfer-Encoding: 8bit scsi_debug reports the lowest_aligned module parameter in the LOWEST ALIGNED LOGICAL BLOCK ADDRESS field, see SBC-6 r02 (T10/BSR INCITS 587), 5.20.2, but nothing else in the driver acts on it. On a zoned device a non-zero value puts the start of every zone in the middle of a physical block. ZBC requires a write to a sequential write required zone to end on a physical block boundary, so a host writing in units of the reported zone write granularity could never write such a zone at all. Refuse the combination rather than emulate a device that cannot be used. Assisted-by: LLM Reviewed-by: Damien Le Moal Signed-off-by: Niklas Cassel --- Tested by loading the module with each combination: zbc=managed lowest_aligned=8 refused, -EINVAL zbc=aware lowest_aligned=8 refused, -EINVAL zbc=managed lowest_aligned=0 loads lowest_aligned=8 loads, as the device is not zoned --- drivers/scsi/scsi_debug.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 6941809dfdb7..c664966e95cb 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -8734,6 +8734,11 @@ static int __init scsi_debug_init(void) sdebug_dev_size_mb = DEF_ZBC_DEV_SIZE_MB; } + if (sdeb_zbc_in_use && sdebug_lowest_aligned) { + pr_err("lowest_aligned is not supported by a zoned device\n"); + return -EINVAL; + } + if (sdebug_dev_size_mb == DEF_DEV_SIZE_PRE_INIT) sdebug_dev_size_mb = DEF_DEV_SIZE_MB; if (sdebug_dev_size_mb < 1) -- 2.55.0