Commit 1068be7b authored by Bryant G. Ly's avatar Bryant G. Ly Committed by Nicholas Bellinger

tcmu: Add netlink for device reconfiguration

This gives tcmu the ability to handle events that can cause
reconfiguration, such as resize, path changes, write_cache, etc...
Signed-off-by: default avatarBryant G. Ly <bryantly@linux.vnet.ibm.com>
Reviewed-By: default avatarMike Christie <mchristi@redhat.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 9a8bb606
...@@ -1562,6 +1562,7 @@ static ssize_t tcmu_emulate_write_cache_store(struct config_item *item, ...@@ -1562,6 +1562,7 @@ static ssize_t tcmu_emulate_write_cache_store(struct config_item *item,
{ {
struct se_dev_attrib *da = container_of(to_config_group(item), struct se_dev_attrib *da = container_of(to_config_group(item),
struct se_dev_attrib, da_group); struct se_dev_attrib, da_group);
struct tcmu_dev *udev = TCMU_DEV(da->da_dev);
int val; int val;
int ret; int ret;
...@@ -1570,6 +1571,17 @@ static ssize_t tcmu_emulate_write_cache_store(struct config_item *item, ...@@ -1570,6 +1571,17 @@ static ssize_t tcmu_emulate_write_cache_store(struct config_item *item,
return ret; return ret;
da->emulate_write_cache = val; da->emulate_write_cache = val;
/* Check if device has been configured before */
if (tcmu_dev_configured(udev)) {
ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE,
udev->uio_info.name,
udev->uio_info.uio_dev->minor);
if (ret) {
pr_err("Unable to reconfigure device\n");
return ret;
}
}
return count; return count;
} }
CONFIGFS_ATTR(tcmu_, emulate_write_cache); CONFIGFS_ATTR(tcmu_, emulate_write_cache);
......
...@@ -130,6 +130,7 @@ enum tcmu_genl_cmd { ...@@ -130,6 +130,7 @@ enum tcmu_genl_cmd {
TCMU_CMD_UNSPEC, TCMU_CMD_UNSPEC,
TCMU_CMD_ADDED_DEVICE, TCMU_CMD_ADDED_DEVICE,
TCMU_CMD_REMOVED_DEVICE, TCMU_CMD_REMOVED_DEVICE,
TCMU_CMD_RECONFIG_DEVICE,
__TCMU_CMD_MAX, __TCMU_CMD_MAX,
}; };
#define TCMU_CMD_MAX (__TCMU_CMD_MAX - 1) #define TCMU_CMD_MAX (__TCMU_CMD_MAX - 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment