From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80BCB606A320 for ; Sun, 8 Nov 2026 20:47:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=NnmrFET5; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=W52V0x6q DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Unsubscribe-Post:List-Owner; bh=xjhWBUZih10V7YJdGXZxprUPzNAlZFyeQN11ftb+jJ0=; b=NnmrFET5SXBrR66FP0vLXKac/r jtUwLuQPgUR4s4pLO6Uuetf7xJigzqI8Fmz1MQBuKplICcBSHZvPhDlMPithKm+RBS5aGb8YSe/AU XhZ3CLWwnc5C8mSvSeh5+cZwpsSB5Z2MSpeJbihv3a4baa5usDpTy3ivduginmQ2SKJ0yj3rgQunG nrlXaU2O96dwETq6cYmEnKPjdj7SlOfA0Wrd+0al/2aAOsDHAaPrUJXjkZmKztnuvCZbRv3Tc0WNq vA/jlnQ7YL1ABq52ap6NJLyrxL1UoDIeYBFh3YIIGqqqudW112UzRtkknaTYQl9m/OEeBVT2X3bNP yRK4w90A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xQ9nx-0000000GbhQ-0SYM; Sun, 08 Nov 2026 20:47:57 +0000 Received: from out-9.mta1.migadu.com ([95.215.58.9] helo=mta1.migadu.com) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xQ9nt-0000000GbgO-0G5n for linux-nvme@lists.infradead.org; Sun, 08 Nov 2026 20:47:55 +0000 X-Envelope-To: linux-nvme@lists.infradead.org DKIM-Signature: a=rsa-sha256; bh=2rsZwfjFMq/a1Kzo/urx8D8cn0WOpZhxUsbpq63LXSg=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1794170869; v=1; x=1794775669; b=W52V0x6qMUBB5Rr/auBLIUKg0y/4UxEcPe1QEZLpfuZ/70uD7UwyLxNTNEoAJkbGQh/SeEhp X2qsFbphdp/sOHw81JonEDdNxcPOP2TLYjQVVwXb0G6A9FUFmFM8Om5dMbSS8Dx6Q9EKKxTC2/B mQ+kbZ6LgAVcAKGEudEiiJdE= X-Envelope-To: linux-nvme@lists.infradead.org Received: by mta10.migadu.com with ESMTPS id dd57490ad9f8d74e; Sun, 08 Nov 2026 20:47:49 +0000 X-Mizu-Trace-ID: dd57490ad9f8d74e X-Migadu-Flow: FLOW_OUT From: John Garry To: james.bottomley@hansenpartnership.com, mkp@kernel.org Cc: hare@suse.com, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, snitzer@kernel.org, jmeneghi@redhat.com, bmarzins@redhat.com, dm-devel@lists.linux.dev, hch@lst.de, michael.christie@oracle.com, John Garry Subject: [PATCH v9 00/29] Native SCSI Multipath support Date: Sun, 8 Nov 2026 20:47:04 +0000 Message-ID: <20261108204733.557995-1-john.garry@linux.dev> X-Mailer: git-send-email 2.43.0 X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261108_124753_537347_510715C0 X-CRM114-Status: GOOD ( 17.11 ) X-Spam-Score: -2.8 (--) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" X-Spam-Status: No, score=-18.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 NATIVE SCSI MULTIPATH: This series introduces native SCSI multipath support. It is intended as an alternative to dm-mpath. This support aims to provide a multipath-enabled SCSI block device/ gendisk. For a SCSI device to support native multipath, either of the following conditions must be satisfied: a. unique ID in VPD page 83 and ALUA support and scsi_multipath modparam enabled b. unique ID in VPD page 83 and scsi_multipath_always modparam enabled This series relies on reading sdev->access_state to get path information. This path information would be provided by ALUA. ALUA support which does not rely on device handlers has already been discussed at https://lore.kernel.org/linux-scsi/7755e98f-5619-48ba-bcfc-b64eec930c40@oracle.com/ and support will be added in the next phase. New classes of devices are added: - scsi_mpath_device - scsi_mpath_disk These are required since a multipath scsi_device has no common scsi host. An example of the sysfs files and directories for these new classes is as follows: $ ls -l /sys/class/scsi_mpath_device/scsi_mpath_device0/ total 0 -rw-r--r-- 1 root root 4096 Feb 25 11:59 iopolicy drwxr-xr-x 2 root root 0 Feb 25 11:59 multipath drwxr-xr-x 2 root root 0 Feb 25 11:59 power lrwxrwxrwx 1 root root 0 Feb 25 11:59 subsystem -> ../../../../class/scsi_mpath_device -rw-r--r-- 1 root root 4096 Feb 25 11:58 uevent -r--r--r-- 1 root root 4096 Feb 25 11:59 vpd_id $ ls -l /sys/class/scsi_mpath_device/scsi_mpath_device0/multipath/ total 0 lrwxrwxrwx 1 root root 0 Feb 25 11:59 8:0:0:0 -> ../../../../platform/host8/session1/target8:0:0/8:0:0:0 lrwxrwxrwx 1 root root 0 Feb 25 11:59 9:0:0:0 -> ../../../../platform/host9/session2/target9:0:0/9:0:0:0 $ cat /sys/class/scsi_mpath_device/scsi_mpath_device0/vpd_id naa.600140505200a986f0043c9afa1fd077 $ cat /sys/class/scsi_mpath_device/scsi_mpath_device0/iopolicy numa $ $ ls -l /sys/class/scsi_mpath_disk/scsi_mpath_disk0/ total 0 drwxr-xr-x 2 root root 0 Feb 25 12:00 power drwxr-xr-x 11 root root 0 Feb 25 11:58 sdc lrwxrwxrwx 1 root root 0 Feb 25 11:58 subsystem -> ../../../../class/scsi_mpath_disk -rw-r--r-- 1 root root 4096 Feb 25 11:58 uevent $ ls -l /sys/class/scsi_mpath_disk/scsi_mpath_disk0/sdc/multipath/ total 0 lrwxrwxrwx 1 root root 0 Feb 25 12:00 sdc:0 -> ../../../../../platform/host8/session1/target8:0:0/8:0:0:0/block/sdc:0 lrwxrwxrwx 1 root root 0 Feb 25 12:00 sdc:1 -> ../../../../../platform/host9/session2/target9:0:0/9:0:0:0/block/sdc:1 $ ls -l /dev/sdc brw-rw---- 1 root disk 8, 32 Feb 25 11:58 /dev/sdc The scsi_device and scsi_disk classes otherwise remain unmodified. However, the per-path block device is hidden in /dev/. Furthermore, multipathed block devices have a new naming scheme, sdX:Y, where X is the scsi multipath device index and Y is the path index. No multipath sg support is added. We still have a per-path sg device. Since the SCSI block device is multipath enabled, we can access multipathed scsi_ioctl() through that block device. For failover, we take the approach of cloning bio's and re-submitting them in full (for failover errors). LIBMULTIPATH: This series introduces also libmultipath. It is essentially a refactoring of NVME multipath support, so we can have a common library to also support native SCSI multipath. Much of the code is taken directly from the NVMe multipath code. However, NVMe specifics are removed. A template structure is provided so the driver -may provide callbacks for driver specifics, like ANA support for NVMe. Important new structures introduced include: - mpath_head These contain much of the multipath-specific functionality from nvme_ns_head, including a pointer to the gendisk structure and a path SRCU-based array. - mpath_device This is the per-path structure, and contains much the same multipath-specific functionality in nvme_ns libmultipath provides functionality for path management, path selection, data path, and failover handling. Full series also available at https://github.com/johnpgarry/linux/tree/scsi-multipath-v7.4-v9 Differences to v8: - Rebase - Hardening changes advised by sashiko, including "Clear cmd->flags" change Differences to v7: - rebase - simplify scsi_mpath_clone_end_io() (sashiko) - rename bio_list_add_clone() -> bio_list_add_master() - rework checks in mpath_alloc_disk_head() (sashiko) John Garry (29): scsi: core: Clear cmd->flags for terminal queuing error libmultipath: Add initial framework libmultipath: Add basic gendisk support libmultipath: Add path selection support libmultipath: Add bio handling libmultipath: Add support for mpath_device management libmultipath: Add delayed removal support libmultipath: Add sysfs helpers libmultipath: Add support for block device IOCTL libmultipath: Add mpath_bdev_getgeo() libmultipath: Add mpath_bdev_get_unique_id() scsi-multipath: introduce basic SCSI device support scsi-multipath: introduce scsi_device head structure scsi-multipath: provide sysfs link from to scsi_device scsi-multipath: support iopolicy scsi-multipath: clone each bio scsi-multipath: clear path when device is blocked scsi-multipath: revalidate paths upon device unblock scsi-multipath: failover handling scsi-multipath: provide callbacks for path state scsi-multipath: add scsi_mpath_{start,end}_request() scsi-multipath: update request for terminal request queuing error scsi-multipath: add delayed disk removal support scsi: sd: add multipath disk class scsi: sd: add multipath disk attr groups scsi: sd: support multipath disk scsi: sd: add mpath_dev file scsi: sd: add mpath_numa_nodes dev attribute scsi: sd: add mpath_queue_depth dev attribute drivers/scsi/Kconfig | 10 + drivers/scsi/Makefile | 1 + drivers/scsi/scsi.c | 8 +- drivers/scsi/scsi_lib.c | 20 +- drivers/scsi/scsi_multipath.c | 691 +++++++++++++++++++++++++ drivers/scsi/scsi_scan.c | 4 + drivers/scsi/scsi_sysfs.c | 10 + drivers/scsi/sd.c | 611 +++++++++++++++++++++- drivers/scsi/sd.h | 3 + include/linux/multipath.h | 156 ++++++ include/scsi/scsi_cmnd.h | 9 +- include/scsi/scsi_device.h | 2 + include/scsi/scsi_driver.h | 4 + include/scsi/scsi_host.h | 4 + include/scsi/scsi_multipath.h | 129 +++++ lib/Kconfig | 6 + lib/Makefile | 2 + lib/multipath.c | 948 ++++++++++++++++++++++++++++++++++ 18 files changed, 2592 insertions(+), 26 deletions(-) create mode 100644 drivers/scsi/scsi_multipath.c create mode 100644 include/linux/multipath.h create mode 100644 include/scsi/scsi_multipath.h create mode 100644 lib/multipath.c -- 2.43.0