On Wed, Feb 25, 2026 at 03:32:23PM +0000, John Garry wrote: > 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 <[email protected]> > --- > include/linux/multipath.h | 4 ++++ > lib/multipath.c | 42 +++++++++++++++++++++++++++++++++++++++ > 2 files changed, 46 insertions(+) > > diff --git a/include/linux/multipath.h b/include/linux/multipath.h > index 3846ea8cfd319..40dda6a914c5f 100644 > --- a/include/linux/multipath.h > +++ b/include/linux/multipath.h > @@ -72,6 +72,9 @@ struct mpath_head_template { > bool (*is_disabled)(struct mpath_device *); > bool (*is_optimized)(struct mpath_device *); > enum mpath_access_state (*get_access_state)(struct mpath_device *); > + int (*bdev_ioctl)(struct block_device *bdev, struct mpath_device *, > + blk_mode_t mode, unsigned int cmd, unsigned long arg, > + int srcu_idx);
I don't know that this API is going to work out. SCSI persistent reservations need access to all the mpath_devices, not just one, and they are commonly handled via SG_IO ioctls. Unless you want to disallow SCSI persistent reservations via SG_IO, you need to be able to detect them, and handle them using the persistent reservation code with the mpath_head. -Ben

