Skip to content

libmultipath: a generic multipath lib for block drivers#593

Open
blktests-ci[bot] wants to merge 13 commits intolinus-master_basefrom
series/1057870=>linus-master
Open

libmultipath: a generic multipath lib for block drivers#593
blktests-ci[bot] wants to merge 13 commits intolinus-master_basefrom
series/1057870=>linus-master

Conversation

@blktests-ci
Copy link

@blktests-ci blktests-ci bot commented Feb 25, 2026

Pull request for series with
subject: libmultipath: a generic multipath lib for block drivers
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1057870

@blktests-ci
Copy link
Author

blktests-ci bot commented Feb 25, 2026

Upstream branch: 7dff99b
series: https://patchwork.kernel.org/project/linux-block/list/?series=1057870
version: 1

@blktests-ci
Copy link
Author

blktests-ci bot commented Feb 27, 2026

Upstream branch: a75cb86
series: https://patchwork.kernel.org/project/linux-block/list/?series=1057870
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1057870=>linus-master branch from ca0b65b to 4e13300 Compare February 27, 2026 16:34
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 14f6b99 to 856dc37 Compare February 27, 2026 22:07
@blktests-ci
Copy link
Author

blktests-ci bot commented Feb 27, 2026

Upstream branch: 4d349ee
series: https://patchwork.kernel.org/project/linux-block/list/?series=1057870
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1057870=>linus-master branch from 4e13300 to 011d487 Compare February 27, 2026 22:13
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 856dc37 to 40967f0 Compare March 2, 2026 09:22
@blktests-ci
Copy link
Author

blktests-ci bot commented Mar 2, 2026

Upstream branch: 11439c4
series: https://patchwork.kernel.org/project/linux-block/list/?series=1057870
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1057870=>linus-master branch from 011d487 to a540498 Compare March 2, 2026 09:29
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 40967f0 to d4e9bad Compare March 2, 2026 23:54
@blktests-ci
Copy link
Author

blktests-ci bot commented Mar 3, 2026

Upstream branch: af4e9ef
series: https://patchwork.kernel.org/project/linux-block/list/?series=1057870
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1057870=>linus-master branch from a540498 to d738009 Compare March 3, 2026 00:01
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch 2 times, most recently from ecd10e2 to d0e1bed Compare March 4, 2026 07:45
@blktests-ci
Copy link
Author

blktests-ci bot commented Mar 4, 2026

Upstream branch: af4e9ef
series: https://patchwork.kernel.org/project/linux-block/list/?series=1057870
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1057870=>linus-master branch from d738009 to 93cd20d Compare March 4, 2026 07:57
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from d0e1bed to 6b51c57 Compare March 4, 2026 09:34
@blktests-ci
Copy link
Author

blktests-ci bot commented Mar 4, 2026

Upstream branch: 0031c06
series: https://patchwork.kernel.org/project/linux-block/list/?series=1057870
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1057870=>linus-master branch from 93cd20d to 9626d5b Compare March 4, 2026 09:41
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 6b51c57 to 78036b2 Compare March 4, 2026 19:57
@blktests-ci
Copy link
Author

blktests-ci bot commented Mar 4, 2026

Upstream branch: ecc64d2
series: https://patchwork.kernel.org/project/linux-block/list/?series=1057870
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1057870=>linus-master branch from 9626d5b to 8287fd3 Compare March 4, 2026 20:03
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 78036b2 to bbb3394 Compare March 5, 2026 12:20
@blktests-ci
Copy link
Author

blktests-ci bot commented Mar 5, 2026

Upstream branch: c107785
series: https://patchwork.kernel.org/project/linux-block/list/?series=1057870
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1057870=>linus-master branch from 8287fd3 to 627d97f Compare March 5, 2026 12:30
@blktests-ci blktests-ci bot force-pushed the series/1057870=>linus-master branch from c43a188 to 1a61b9f Compare March 11, 2026 08:14
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from e79276a to 0dd9afc Compare March 12, 2026 01:40
@blktests-ci
Copy link
Author

blktests-ci bot commented Mar 12, 2026

Upstream branch: 80234b5
series: https://patchwork.kernel.org/project/linux-block/list/?series=1057870
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1057870=>linus-master branch from 1a61b9f to 2b99348 Compare March 12, 2026 02:10
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 0dd9afc to 2e598ed Compare March 13, 2026 07:29
@blktests-ci
Copy link
Author

blktests-ci bot commented Mar 13, 2026

Upstream branch: 0257f64
series: https://patchwork.kernel.org/project/linux-block/list/?series=1057870
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1057870=>linus-master branch from 2b99348 to 02b2551 Compare March 13, 2026 07:46
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch 2 times, most recently from 1b884bd to 3ff0536 Compare March 15, 2026 07:50
@blktests-ci
Copy link
Author

blktests-ci bot commented Mar 15, 2026

Upstream branch: 0257f64
series: https://patchwork.kernel.org/project/linux-block/list/?series=1057870
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1057870=>linus-master branch from 02b2551 to e78b3c0 Compare March 15, 2026 07:58
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 3ff0536 to 868d59a Compare March 18, 2026 03:04
@blktests-ci
Copy link
Author

blktests-ci bot commented Mar 18, 2026

Upstream branch: a989fde
series: https://patchwork.kernel.org/project/linux-block/list/?series=1057870
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1057870=>linus-master branch from e78b3c0 to 827f502 Compare March 18, 2026 03:19
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 868d59a to 1f531be Compare March 18, 2026 11:51
Add initial framework for libmultipath. libmultipath is a library for
multipath-capable block drivers, such as NVMe. The main function is to
support path management, path selection, and failover handling.

Basic support to add and remove the head structure - mpath_head - is
included.

This main purpose of this structure is to manage available paths and path
selection. It is quite similar to the multipath functionality in
nvme_ns_head. However a separate structure will introduced after to manage
the multipath gendisk.

Each path is represented by the mpath_device structure. It should hold a
pointer to the per-path gendisk and also a list element for all siblings
of paths. For NVMe, there would be a mpath_device per nvme_ns.

All the libmultipath code is more or less taken from
drivers/nvme/host/multipath.c, which was originally authored by Christoph
Hellwig <hch@lst.de>.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Add support to allocate and free a multipath gendisk.

NVMe has almost like-for-like equivalents here:
- mpath_alloc_head_disk() -> nvme_mpath_alloc_disk()
- multipath_partition_scan_work() -> nvme_partition_scan_work()
- mpath_remove_disk() -> nvme_remove_head()
- mpath_device_set_live() -> nvme_mpath_set_live()

struct mpath_head_template is introduced as a method for drivers to
provide custom multipath functionality.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Add code for path selection.

NVMe ANA is abstracted into enum mpath_access_state. The motivation here is
so that SCSI ALUA can be used. Callbacks .is_disabled, .is_optimized,
.get_access_state are added to get the path access state.

Path selection modes round-robin, NUMA, and queue-depth are added, same
as NVMe supports.

NVMe has almost like-for-like equivalents here:
- __mpath_find_path() -> __nvme_find_path()
- mpath_find_path() -> nvme_find_path()

and similar for all introduced callee functions.

Functions mpath_set_iopolicy() and mpath_get_iopolicy() are added for
setting default iopolicy.

A separate mpath_iopolicy structure is introduced. There is no iopolicy
member included in the mpath_head structure as it may not suit NVMe, where
iopolicy is per-subsystem and not per namespace.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Add support to submit a bio per-path. In addition, for failover, add
support to requeue a failed bio.

NVMe has almost like-for-like equivalents here:
    - nvme_available_path() -> mpath_available_path()
    - nvme_requeue_work() -> mpath_requeue_work()
    - nvme_ns_head_submit_bio() -> mpath_bdev_submit_bio()

For failover, a driver may want to re-submit a bio, so add support to
clone a bio prior to submission.

A bio which is submitted to a per-path device has flag REQ_MPATH set,
same as what is done for NVMe with REQ_NVME_MPATH.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Add support to add or remove a mpath_device as a path.

NVMe has almost like-for-like equivalents here:
- nvme_mpath_clear_current_path() -> mpath_clear_current_path()
- nvme_mpath_add_sysfs_link() -> mpath_add_sysfs_link()
- nvme_mpath_remove_sysfs_link() -> mpath_remove_sysfs_link()
- nvme_mpath_revalidate_paths() -> mpath_revalidate_paths()

mpath_revalidate_paths() has a CB arg for NVMe specific handling.

The functionality in mpath_clear_paths() and mpath_synchronize() have the
same pattern which is frequently used in the NVMe code.

Helper mpath_call_for_device() is added to allow a driver run a callback
on any path available. It is intended to be used for occasions when the
NVMe drivers accesses the list of paths outside its multipath code, like
NVMe sysfs.c

Signed-off-by: John Garry <john.g.garry@oracle.com>
Add support to create a cdev multipath device. The functionality is much
the same as NVMe, where the cdev is created when a mpath device is set
live.

The driver must provide a mpath_head_template.cdev_ioctl callback to
actually handle the ioctl.

Structure mpath_generic_chr_fops would be used for setting the cdev fops in
the mpath_head_template.add_cdev callback.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Add support for delayed removal, same as exists for NVMe.

The purpose of this feature is to keep the multipath disk and cdev present
for intermittent periods of no available path.

Helpers mpath_delayed_removal_secs_show() and
mpath_delayed_removal_secs_store() may be used in the driver sysfs code.

The driver is responsible for supplying the removal work callback for
the delayed work.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Add helpers for driver sysfs code for the following functionality:
- get/set iopolicy with mpath_iopolicy_store() and mpath_iopolicy_show()
- show device path per NUMA node
- "multipath" attribute group, equivalent to nvme_ns_mpath_attr_group
- device groups attribute array, similar to nvme_ns_attr_groups but not
  containing NVMe members.

Note that mpath_iopolicy_store() has a update callback to allow same
functionality as nvme_subsys_iopolicy_update() be run for clearing paths.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Add support for persistent reservations.

Effectively all that is done here is that a multipath version of pr_ops is
created which calls into the driver version of the callbacks for the
mpath_device selected.

Structure mpath_pr_ops is introduced, which must be set by the driver for
PR callbacks.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Add a multipath handler for block_device_operations.report_zones

Signed-off-by: John Garry <john.g.garry@oracle.com>
Add mpath_bdev_ioctl() as a multipath block device IOCTL handler. This
handler calls into driver mpath_head_template.ioctl handler.

It is expected that the .ioctl handler will unlock the SRCU read lock,
as this is what NVMe requires - see nvme_ns_head_ctrl_ioctl(). As such,
export a handler to unlock, mpath_head_read_unlock().

The .compat_ioctl handler is given the standard handler.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Add mpath_bdev_getgeo() as a multipath block device .getgeo handler.

Here we just redirect into the selected mpath_device disk fops->getgeo
handler.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Add mpath_bdev_get_unique_id() as a multipath block device .get_unique_id
handler.

Signed-off-by: John Garry <john.g.garry@oracle.com>
@blktests-ci
Copy link
Author

blktests-ci bot commented Mar 18, 2026

Upstream branch: a989fde
series: https://patchwork.kernel.org/project/linux-block/list/?series=1057870
version: 1

@blktests-ci blktests-ci bot force-pushed the series/1057870=>linus-master branch from 827f502 to 1cf1370 Compare March 18, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant