Multipath cannot directly provide failover for ioctls in the kernel because it doesn't know what each ioctl means and which result could indicate a path error. Userspace generally knows what the ioctl it issued means and if it might be a path error, but neither does it know which path the ioctl took nor does it necessarily have the privileges to fail a path using the control device.
This series adds an interface that userspace can use to probe paths and fail the bad ones after seeing a potential path error in an ioctl result. Once the bad paths are eliminated, the ioctl can be retried. While the fundamental problem is relatively broad and can affect any sort of ioctl, the immediate motivation for this is the use of SG_IO in QEMU for SCSI passthrough. A preliminary QEMU side patch that makes use of the new interface to support multipath failover with SCSI passthrough can be found at: https://repo.or.cz/qemu/kevin.git/commitdiff/78a474da3b39469b11fbb1d4e0ddf4797b637d35 Kevin Wolf (2): dm: Allow .prepare_ioctl to handle ioctls directly dm mpath: Interface for explicit probing of active paths include/linux/device-mapper.h | 9 +++- include/uapi/linux/dm-ioctl.h | 9 +++- drivers/md/dm-dust.c | 4 +- drivers/md/dm-ebs-target.c | 3 +- drivers/md/dm-flakey.c | 4 +- drivers/md/dm-ioctl.c | 1 + drivers/md/dm-linear.c | 4 +- drivers/md/dm-log-writes.c | 4 +- drivers/md/dm-mpath.c | 95 ++++++++++++++++++++++++++++++++++- drivers/md/dm-switch.c | 4 +- drivers/md/dm-verity-target.c | 4 +- drivers/md/dm-zoned-target.c | 3 +- drivers/md/dm.c | 17 ++++--- 13 files changed, 142 insertions(+), 19 deletions(-) -- 2.49.0