summaryrefslogtreecommitdiff
path: root/drivers/target
diff options
context:
space:
mode:
authorBryant G. Ly <bryantly@linux.vnet.ibm.com>2017-06-06 09:28:49 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2017-07-06 23:11:30 -0700
commit1068be7bd4b05ca41a6a8de724f52a9c87861412 (patch)
tree5ce826122611e651f0a684cb220c36f9aaa9b609 /drivers/target
parent9a8bb60650b3d6994bd19a3200941f029c95a7a0 (diff)
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: Bryant G. Ly <bryantly@linux.vnet.ibm.com> Reviewed-By: Mike Christie <mchristi@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_user.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index 0c797cc69d9e..ae918222284b 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -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_group);
+ struct tcmu_dev *udev = TCMU_DEV(da->da_dev);
int val;
int ret;
@@ -1570,6 +1571,17 @@ static ssize_t tcmu_emulate_write_cache_store(struct config_item *item,
return ret;
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;
}
CONFIGFS_ATTR(tcmu_, emulate_write_cache);