Set multipath disk attr groups, which includes delayed disk removal and everything from mpath_attr_group.
Signed-off-by: John Garry <[email protected]> --- drivers/scsi/sd.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 3df70b24b688e..a9a29e50f5eec 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -4106,6 +4106,41 @@ static void sd_mpath_add_disk(struct scsi_disk *sdkp) mpath_device_set_live(mpath_device); } +static ssize_t sd_mpath_device_delayed_removal_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) +{ + struct mpath_head *mpath_head = mpath_bd_device_to_head(dev); + + return mpath_delayed_removal_secs_store(mpath_head, buf, count); +} + +static ssize_t sd_mpath_device_delayed_removal_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct mpath_head *mpath_head = mpath_bd_device_to_head(dev); + + return mpath_delayed_removal_secs_show(mpath_head, buf); +} + +static DEVICE_ATTR(delayed_removal_secs, S_IRUGO | S_IWUSR, + sd_mpath_device_delayed_removal_show, + sd_mpath_device_delayed_removal_store); + +static struct attribute *sd_mpath_disk_attrs[] = { + &dev_attr_delayed_removal_secs.attr, + NULL +}; + +static const struct attribute_group sd_mpath_disk_attr_group = { + .attrs = sd_mpath_disk_attrs, +}; + +static const struct attribute_group *sd_mpath_disk_attr_groups[] = { + &sd_mpath_disk_attr_group, + &mpath_attr_group, + NULL +}; + static int sd_mpath_probe(struct scsi_disk *sdkp) { struct scsi_device *sdp = sdkp->device; @@ -4161,6 +4196,7 @@ static int sd_mpath_probe(struct scsi_disk *sdkp) mpath_head->parent = &sd_mpath_disk->dev; mpath_head->drv_module = THIS_MODULE; + mpath_head->disk_groups = sd_mpath_disk_attr_groups; error = mpath_alloc_head_disk(mpath_head, &lim, dev_to_node(dma_dev)); if (error) -- 2.43.7

