public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/18] Native SCSI multipath support
@ 2026-04-28 11:14 John Garry
  2026-04-28 11:14 ` [PATCH v2 01/18] scsi-multipath: introduce basic SCSI device support John Garry
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: John Garry @ 2026-04-28 11:14 UTC (permalink / raw)
  To: hch, kbusch, sagi, axboe, martin.petersen, james.bottomley, hare,
	bmarzins, nilay
  Cc: jmeneghi, linux-nvme, linux-scsi, michael.christie, snitzer,
	dm-devel, linux-kernel, John Garry

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).

Full series also available at
https://github.com/johnpgarry/linux/commits/scsi-multipath-pre-7.1-upstream-v2/

Differences to v1 (apart from porting changes for v2 libmultiapth):
- drop SCSI_MAX_QUEUE_DEPTH and reduce bioset size (Benjamin)
- increase SCSI_MPATH_DEVICE_ID_LEN (Benjamin)
- mark config SCSI_MULTIPATH as experimental (Benjamin)
- combine modparams (Hannes)
- rename wwid sysfs file to vpd_id (Hannes)
- return umode_t from scsi_multipath_sysfs_attr_visible() (Benjamin)
- use DEFINE_SYSFS_GROUP_VISIBLE() (Benjamin)
- fix scsi_mpath_end_request() and blk stats (Benjamin)
- change scsi_mpath_device and scsi_mpath_disk device naming (Hannes)
- change locking in scsi_mpath_dev_alloc() and sd_mpath_probe() (Benjamin)
- drop struct scsi_mpath_clone_bio (Benjamin)
- don't use scsi_mpath_clone_bio() -> bio_alloc_clone(GFP_NOWAIT) (Benjamin)
- don't use BIOSET_NEED_BVECS for bioset_init() (Benjamin)
- drop PR support (problems explained by Benjamin)
- drop failover handling in mpath bio completion (Benjamin)
- use sdev->access_state in scsi_mpath_is_optimized()
- count queue depth per shost
- delayed disk removal support

John Garry (18):
  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 decide is blocked
  scsi-multipath: failover handling
  scsi-multipath: provide callbacks for path state
  scsi-multipath: add scsi_mpath_get_nr_active()
  scsi-multipath: add scsi_mpath_{start,end}_request()
  scsi-multipath: block PR commands
  scsi-multipath: add delayed disk removal support
  scsi: sd: add multipath disk class
  scsi: sd: support multipath disk
  scsi: sd: add multipath disk attr groups
  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       |  15 +
 drivers/scsi/scsi_multipath.c | 658 ++++++++++++++++++++++++++++++++++
 drivers/scsi/scsi_scan.c      |   4 +
 drivers/scsi/scsi_sysfs.c     |  10 +
 drivers/scsi/sd.c             | 560 +++++++++++++++++++++++++++--
 drivers/scsi/sd.h             |   3 +
 include/scsi/scsi_cmnd.h      |   5 +
 include/scsi/scsi_device.h    |   2 +
 include/scsi/scsi_driver.h    |   4 +
 include/scsi/scsi_host.h      |   4 +
 include/scsi/scsi_multipath.h | 113 ++++++
 14 files changed, 1376 insertions(+), 21 deletions(-)
 create mode 100644 drivers/scsi/scsi_multipath.c
 create mode 100644 include/scsi/scsi_multipath.h

-- 
2.43.5


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2026-04-28 11:17 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-28 11:14 [PATCH v2 00/18] Native SCSI multipath support John Garry
2026-04-28 11:14 ` [PATCH v2 01/18] scsi-multipath: introduce basic SCSI device support John Garry
2026-04-28 11:14 ` [PATCH v2 02/18] scsi-multipath: introduce scsi_device head structure John Garry
2026-04-28 11:14 ` [PATCH v2 03/18] scsi-multipath: provide sysfs link from to scsi_device John Garry
2026-04-28 11:14 ` [PATCH v2 04/18] scsi-multipath: support iopolicy John Garry
2026-04-28 11:14 ` [PATCH v2 05/18] scsi-multipath: clone each bio John Garry
2026-04-28 11:14 ` [PATCH v2 06/18] scsi-multipath: clear path when decide is blocked John Garry
2026-04-28 11:14 ` [PATCH v2 07/18] scsi-multipath: failover handling John Garry
2026-04-28 11:14 ` [PATCH v2 08/18] scsi-multipath: provide callbacks for path state John Garry
2026-04-28 11:14 ` [PATCH v2 09/18] scsi-multipath: add scsi_mpath_get_nr_active() John Garry
2026-04-28 11:14 ` [PATCH v2 10/18] scsi-multipath: add scsi_mpath_{start,end}_request() John Garry
2026-04-28 11:14 ` [PATCH v2 11/18] scsi-multipath: block PR commands John Garry
2026-04-28 11:14 ` [PATCH v2 12/18] scsi-multipath: add delayed disk removal support John Garry
2026-04-28 11:14 ` [PATCH v2 13/18] scsi: sd: add multipath disk class John Garry
2026-04-28 11:14 ` [PATCH v2 14/18] scsi: sd: support multipath disk John Garry
2026-04-28 11:14 ` [PATCH v2 15/18] scsi: sd: add multipath disk attr groups John Garry
2026-04-28 11:14 ` [PATCH v2 16/18] scsi: sd: add mpath_dev file John Garry
2026-04-28 11:14 ` [PATCH v2 17/18] scsi: sd: add mpath_numa_nodes dev attribute John Garry
2026-04-28 11:14 ` [PATCH v2 18/18] scsi: sd: add mpath_queue_depth " John Garry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox