[PATCH 18/24] scsi: sd: add sd_mpath_ioctl()

From: John Garry

Date: Wed Feb 25 2026 - 10:47:33 EST


Add scsi_driver.mpath_ioctl callback.

Signed-off-by: John Garry <john.g.garry@xxxxxxxxxx>
---
drivers/scsi/sd.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 845d392456549..b807452a4bdc3 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -4070,6 +4070,19 @@ static int sd_format_disk_name(char *prefix, int index, char *buf, int buflen)
return 0;
}

+#ifdef CONFIG_SCSI_MULTIPATH
+static int sd_mpath_ioctl(struct scsi_device *sdp, blk_mode_t mode,
+ unsigned int cmd, unsigned long arg)
+{
+ struct scsi_disk *sdkp = dev_get_drvdata(&sdp->sdev_gendev);
+ struct gendisk *disk = sdkp->disk;
+ struct block_device *bdev = disk->part0;
+
+ return sd_ioctl(bdev, mode, cmd, arg);
+}
+
+#else /* CONFIG_SCSI_MULTIPATH */
+#endif
/**
* sd_probe - called during driver initialization and whenever a
* new scsi device is attached to the system. It is called once
@@ -4522,6 +4535,7 @@ static struct scsi_driver sd_template = {
#ifdef CONFIG_SCSI_MULTIPATH
.mpath_start_cmd = sd_mpath_start_command,
.mpath_end_cmd = sd_mpath_end_command,
+ .mpath_ioctl = sd_mpath_ioctl,
#endif
.done = sd_done,
.eh_action = sd_eh_action,
--
2.43.5