linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/5] tcmu: Add Type of reconfig into netlink
@ 2017-06-06 14:28 Bryant G. Ly
  2017-06-06 14:28 ` [PATCH v4 1/5] tcmu: Support emulate_write_cache Bryant G. Ly
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Bryant G. Ly @ 2017-06-06 14:28 UTC (permalink / raw)
  To: nab, mchristi; +Cc: seroyer, linux-scsi, target-devel, Bryant G. Ly

From: "Bryant G. Ly" <bgly@us.ibm.com>

This patch consists of adding a netlink to allow for reconfiguration
of a device in tcmu.

It also changes and adds some attributes that are reconfigurable:
write_cache, device size, and device path.

V2 - Fixes kfree in tcmu: Make dev_config configurable
V3 - Fixes spelling error
V4 - change strcpy to strlcpy for tcmu_dev_path_store and move
     tcmu_reconfig_type into target_core_user.h


Bryant G. Ly (5):
  tcmu: Support emulate_write_cache
  tcmu: Add netlink for device reconfiguration
  tcmu: Make dev_size configurable via userspace
  tcmu: Make dev_config configurable
  tcmu: Add Type of reconfig into netlink

 drivers/target/target_core_user.c     | 152 ++++++++++++++++++++++++++++++++--
 include/uapi/linux/target_core_user.h |   9 ++
 2 files changed, 155 insertions(+), 6 deletions(-)

-- 
2.5.4 (Apple Git-61)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v4 1/5] tcmu: Support emulate_write_cache
  2017-06-06 14:28 [PATCH v4 0/5] tcmu: Add Type of reconfig into netlink Bryant G. Ly
@ 2017-06-06 14:28 ` Bryant G. Ly
  2017-06-06 14:28 ` [PATCH v4 2/5] tcmu: Add netlink for device reconfiguration Bryant G. Ly
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Bryant G. Ly @ 2017-06-06 14:28 UTC (permalink / raw)
  To: nab, mchristi; +Cc: seroyer, linux-scsi, target-devel, Bryant G. Ly

This will enable the toggling of write_cache in tcmu through targetcli-fb

Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Reviewed-By: Mike Christie <mchristi@redhat.com>
---
 drivers/target/target_core_user.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index beb5f09..0c797cc 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1290,6 +1290,8 @@ static int tcmu_configure_device(struct se_device *dev)
 	/* Other attributes can be configured in userspace */
 	if (!dev->dev_attrib.hw_max_sectors)
 		dev->dev_attrib.hw_max_sectors = 128;
+	if (!dev->dev_attrib.emulate_write_cache)
+		dev->dev_attrib.emulate_write_cache = 0;
 	dev->dev_attrib.hw_queue_depth = 128;
 
 	/*
@@ -1546,6 +1548,32 @@ static ssize_t tcmu_cmd_time_out_store(struct config_item *item, const char *pag
 }
 CONFIGFS_ATTR(tcmu_, cmd_time_out);
 
+static ssize_t tcmu_emulate_write_cache_show(struct config_item *item,
+					     char *page)
+{
+	struct se_dev_attrib *da = container_of(to_config_group(item),
+					struct se_dev_attrib, da_group);
+
+	return snprintf(page, PAGE_SIZE, "%i\n", da->emulate_write_cache);
+}
+
+static ssize_t tcmu_emulate_write_cache_store(struct config_item *item,
+					      const char *page, size_t count)
+{
+	struct se_dev_attrib *da = container_of(to_config_group(item),
+					struct se_dev_attrib, da_group);
+	int val;
+	int ret;
+
+	ret = kstrtouint(page, 0, &val);
+	if (ret < 0)
+		return ret;
+
+	da->emulate_write_cache = val;
+	return count;
+}
+CONFIGFS_ATTR(tcmu_, emulate_write_cache);
+
 static struct configfs_attribute **tcmu_attrs;
 
 static struct target_backend_ops tcmu_ops = {
@@ -1682,6 +1710,8 @@ static int __init tcmu_module_init(void)
 		tcmu_attrs[i] = passthrough_attrib_attrs[i];
 	}
 	tcmu_attrs[i] = &tcmu_attr_cmd_time_out;
+	i++;
+	tcmu_attrs[i] = &tcmu_attr_emulate_write_cache;
 	tcmu_ops.tb_dev_attrib_attrs = tcmu_attrs;
 
 	ret = transport_backend_register(&tcmu_ops);
-- 
2.5.4 (Apple Git-61)

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v4 2/5] tcmu: Add netlink for device reconfiguration
  2017-06-06 14:28 [PATCH v4 0/5] tcmu: Add Type of reconfig into netlink Bryant G. Ly
  2017-06-06 14:28 ` [PATCH v4 1/5] tcmu: Support emulate_write_cache Bryant G. Ly
@ 2017-06-06 14:28 ` Bryant G. Ly
  2017-06-06 14:28 ` [PATCH v4 3/5] tcmu: Make dev_size configurable via userspace Bryant G. Ly
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Bryant G. Ly @ 2017-06-06 14:28 UTC (permalink / raw)
  To: nab, mchristi; +Cc: seroyer, linux-scsi, target-devel, Bryant G. Ly

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>
---
 drivers/target/target_core_user.c     | 12 ++++++++++++
 include/uapi/linux/target_core_user.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index 0c797cc..ae91822 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);
diff --git a/include/uapi/linux/target_core_user.h b/include/uapi/linux/target_core_user.h
index af17b41..403a61f 100644
--- a/include/uapi/linux/target_core_user.h
+++ b/include/uapi/linux/target_core_user.h
@@ -130,6 +130,7 @@ enum tcmu_genl_cmd {
 	TCMU_CMD_UNSPEC,
 	TCMU_CMD_ADDED_DEVICE,
 	TCMU_CMD_REMOVED_DEVICE,
+	TCMU_CMD_RECONFIG_DEVICE,
 	__TCMU_CMD_MAX,
 };
 #define TCMU_CMD_MAX (__TCMU_CMD_MAX - 1)
-- 
2.5.4 (Apple Git-61)

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v4 3/5] tcmu: Make dev_size configurable via userspace
  2017-06-06 14:28 [PATCH v4 0/5] tcmu: Add Type of reconfig into netlink Bryant G. Ly
  2017-06-06 14:28 ` [PATCH v4 1/5] tcmu: Support emulate_write_cache Bryant G. Ly
  2017-06-06 14:28 ` [PATCH v4 2/5] tcmu: Add netlink for device reconfiguration Bryant G. Ly
@ 2017-06-06 14:28 ` Bryant G. Ly
  2017-06-06 14:28 ` [PATCH v4 4/5] tcmu: Make dev_config configurable Bryant G. Ly
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Bryant G. Ly @ 2017-06-06 14:28 UTC (permalink / raw)
  To: nab, mchristi; +Cc: seroyer, linux-scsi, target-devel, Bryant G. Ly

Allow tcmu backstores to be able to set the device size
after it has been configured via set attribute.

Part of support in userspace to support certain backstores
changing device size.

Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
---
 drivers/target/target_core_user.c | 59 +++++++++++++++++++++++++++++++++++----
 1 file changed, 54 insertions(+), 5 deletions(-)

diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index ae91822..c8c84b7 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1548,6 +1548,44 @@ static ssize_t tcmu_cmd_time_out_store(struct config_item *item, const char *pag
 }
 CONFIGFS_ATTR(tcmu_, cmd_time_out);
 
+static ssize_t tcmu_dev_size_show(struct config_item *item, char *page)
+{
+	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);
+
+	return snprintf(page, PAGE_SIZE, "%zu\n", udev->dev_size);
+}
+
+static ssize_t tcmu_dev_size_store(struct config_item *item, const char *page,
+				   size_t count)
+{
+	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);
+	unsigned long val;
+	int ret;
+
+	ret = kstrtoul(page, 0, &val);
+	if (ret < 0)
+		return ret;
+	udev->dev_size = 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_, dev_size);
+
 static ssize_t tcmu_emulate_write_cache_show(struct config_item *item,
 					     char *page)
 {
@@ -1586,6 +1624,13 @@ static ssize_t tcmu_emulate_write_cache_store(struct config_item *item,
 }
 CONFIGFS_ATTR(tcmu_, emulate_write_cache);
 
+struct configfs_attribute *tcmu_attrib_attrs[] = {
+	&tcmu_attr_cmd_time_out,
+	&tcmu_attr_dev_size,
+	&tcmu_attr_emulate_write_cache,
+	NULL,
+};
+
 static struct configfs_attribute **tcmu_attrs;
 
 static struct target_backend_ops tcmu_ops = {
@@ -1685,7 +1730,7 @@ static int unmap_thread_fn(void *data)
 
 static int __init tcmu_module_init(void)
 {
-	int ret, i, len = 0;
+	int ret, i, k, len = 0;
 
 	BUILD_BUG_ON((sizeof(struct tcmu_cmd_entry) % TCMU_OP_ALIGN_SIZE) != 0);
 
@@ -1710,7 +1755,10 @@ static int __init tcmu_module_init(void)
 	for (i = 0; passthrough_attrib_attrs[i] != NULL; i++) {
 		len += sizeof(struct configfs_attribute *);
 	}
-	len += sizeof(struct configfs_attribute *) * 2;
+	for (i = 0; tcmu_attrib_attrs[i] != NULL; i++) {
+		len += sizeof(struct configfs_attribute *);
+	}
+	len += sizeof(struct configfs_attribute *);
 
 	tcmu_attrs = kzalloc(len, GFP_KERNEL);
 	if (!tcmu_attrs) {
@@ -1721,9 +1769,10 @@ static int __init tcmu_module_init(void)
 	for (i = 0; passthrough_attrib_attrs[i] != NULL; i++) {
 		tcmu_attrs[i] = passthrough_attrib_attrs[i];
 	}
-	tcmu_attrs[i] = &tcmu_attr_cmd_time_out;
-	i++;
-	tcmu_attrs[i] = &tcmu_attr_emulate_write_cache;
+	for (k = 0; tcmu_attrib_attrs[k] != NULL; k++) {
+		tcmu_attrs[i] = tcmu_attrib_attrs[k];
+		i++;
+	}
 	tcmu_ops.tb_dev_attrib_attrs = tcmu_attrs;
 
 	ret = transport_backend_register(&tcmu_ops);
-- 
2.5.4 (Apple Git-61)

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v4 4/5] tcmu: Make dev_config configurable
  2017-06-06 14:28 [PATCH v4 0/5] tcmu: Add Type of reconfig into netlink Bryant G. Ly
                   ` (2 preceding siblings ...)
  2017-06-06 14:28 ` [PATCH v4 3/5] tcmu: Make dev_size configurable via userspace Bryant G. Ly
@ 2017-06-06 14:28 ` Bryant G. Ly
  2017-06-06 14:28 ` [PATCH v4 5/5] tcmu: Add Type of reconfig into netlink Bryant G. Ly
  2017-06-09  6:11 ` [PATCH v4 0/5] " Nicholas A. Bellinger
  5 siblings, 0 replies; 12+ messages in thread
From: Bryant G. Ly @ 2017-06-06 14:28 UTC (permalink / raw)
  To: nab, mchristi; +Cc: seroyer, linux-scsi, target-devel, Bryant G. Ly

This allows for userspace to change the device path after
it has been created. Thus giving the user the ability to change
the path. The use case for this is to allow for virtual optical
to have media change.

Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
---
 drivers/target/target_core_user.c | 41 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index c8c84b7..7c64757 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1548,6 +1548,46 @@ static ssize_t tcmu_cmd_time_out_store(struct config_item *item, const char *pag
 }
 CONFIGFS_ATTR(tcmu_, cmd_time_out);
 
+static ssize_t tcmu_dev_path_show(struct config_item *item, char *page)
+{
+	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);
+
+	return snprintf(page, PAGE_SIZE, "%s\n", udev->dev_config);
+}
+
+static ssize_t tcmu_dev_path_store(struct config_item *item, const char *page,
+				   size_t count)
+{
+	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);
+	char *copy = NULL;
+	int ret;
+
+	copy = kstrdup(page, GFP_KERNEL);
+	if (!copy) {
+		kfree(copy);
+		return -EINVAL;
+	}
+	strlcpy(udev->dev_config, copy, TCMU_CONFIG_LEN);
+
+	/* 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_, dev_path);
+
 static ssize_t tcmu_dev_size_show(struct config_item *item, char *page)
 {
 	struct se_dev_attrib *da = container_of(to_config_group(item),
@@ -1626,6 +1666,7 @@ CONFIGFS_ATTR(tcmu_, emulate_write_cache);
 
 struct configfs_attribute *tcmu_attrib_attrs[] = {
 	&tcmu_attr_cmd_time_out,
+	&tcmu_attr_dev_path,
 	&tcmu_attr_dev_size,
 	&tcmu_attr_emulate_write_cache,
 	NULL,
-- 
2.5.4 (Apple Git-61)

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v4 5/5] tcmu: Add Type of reconfig into netlink
  2017-06-06 14:28 [PATCH v4 0/5] tcmu: Add Type of reconfig into netlink Bryant G. Ly
                   ` (3 preceding siblings ...)
  2017-06-06 14:28 ` [PATCH v4 4/5] tcmu: Make dev_config configurable Bryant G. Ly
@ 2017-06-06 14:28 ` Bryant G. Ly
  2017-06-09  6:11 ` [PATCH v4 0/5] " Nicholas A. Bellinger
  5 siblings, 0 replies; 12+ messages in thread
From: Bryant G. Ly @ 2017-06-06 14:28 UTC (permalink / raw)
  To: nab, mchristi; +Cc: seroyer, linux-scsi, target-devel, Bryant G. Ly

This patch adds more info about the attribute being changed,
so that usersapce can easily figure out what is happening.

Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
---
 drivers/target/target_core_user.c     | 20 ++++++++++++++------
 include/uapi/linux/target_core_user.h |  8 ++++++++
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index 7c64757..afc1fd6 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1176,7 +1176,8 @@ static int tcmu_release(struct uio_info *info, struct inode *inode)
 	return 0;
 }
 
-static int tcmu_netlink_event(enum tcmu_genl_cmd cmd, const char *name, int minor)
+static int tcmu_netlink_event(enum tcmu_genl_cmd cmd, const char *name,
+			      int minor, int type)
 {
 	struct sk_buff *skb;
 	void *msg_header;
@@ -1198,6 +1199,10 @@ static int tcmu_netlink_event(enum tcmu_genl_cmd cmd, const char *name, int mino
 	if (ret < 0)
 		goto free_skb;
 
+	ret = nla_put_u32(skb, TCMU_ATTR_TYPE, type);
+	if (ret < 0)
+		goto free_skb;
+
 	genlmsg_end(skb, msg_header);
 
 	ret = genlmsg_multicast_allns(&tcmu_genl_family, skb, 0,
@@ -1301,7 +1306,7 @@ static int tcmu_configure_device(struct se_device *dev)
 	kref_get(&udev->kref);
 
 	ret = tcmu_netlink_event(TCMU_CMD_ADDED_DEVICE, udev->uio_info.name,
-				 udev->uio_info.uio_dev->minor);
+				 udev->uio_info.uio_dev->minor, NO_RECONFIG);
 	if (ret)
 		goto err_netlink;
 
@@ -1383,7 +1388,7 @@ static void tcmu_free_device(struct se_device *dev)
 
 	if (tcmu_dev_configured(udev)) {
 		tcmu_netlink_event(TCMU_CMD_REMOVED_DEVICE, udev->uio_info.name,
-				   udev->uio_info.uio_dev->minor);
+				   udev->uio_info.uio_dev->minor, NO_RECONFIG);
 
 		uio_unregister_device(&udev->uio_info);
 	}
@@ -1577,7 +1582,8 @@ static ssize_t tcmu_dev_path_store(struct config_item *item, const char *page,
 	if (tcmu_dev_configured(udev)) {
 		ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE,
 					 udev->uio_info.name,
-					 udev->uio_info.uio_dev->minor);
+					 udev->uio_info.uio_dev->minor,
+					 CONFIG_PATH);
 		if (ret) {
 			pr_err("Unable to reconfigure device\n");
 			return ret;
@@ -1615,7 +1621,8 @@ static ssize_t tcmu_dev_size_store(struct config_item *item, const char *page,
 	if (tcmu_dev_configured(udev)) {
 		ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE,
 					 udev->uio_info.name,
-					 udev->uio_info.uio_dev->minor);
+					 udev->uio_info.uio_dev->minor,
+					 CONFIG_SIZE);
 		if (ret) {
 			pr_err("Unable to reconfigure device\n");
 			return ret;
@@ -1654,7 +1661,8 @@ static ssize_t tcmu_emulate_write_cache_store(struct config_item *item,
 	if (tcmu_dev_configured(udev)) {
 		ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE,
 					 udev->uio_info.name,
-					 udev->uio_info.uio_dev->minor);
+					 udev->uio_info.uio_dev->minor,
+					 CONFIG_WRITECACHE);
 		if (ret) {
 			pr_err("Unable to reconfigure device\n");
 			return ret;
diff --git a/include/uapi/linux/target_core_user.h b/include/uapi/linux/target_core_user.h
index 403a61f..5b00e35 100644
--- a/include/uapi/linux/target_core_user.h
+++ b/include/uapi/linux/target_core_user.h
@@ -139,8 +139,16 @@ enum tcmu_genl_attr {
 	TCMU_ATTR_UNSPEC,
 	TCMU_ATTR_DEVICE,
 	TCMU_ATTR_MINOR,
+	TCMU_ATTR_TYPE,
 	__TCMU_ATTR_MAX,
 };
 #define TCMU_ATTR_MAX (__TCMU_ATTR_MAX - 1)
 
+enum tcmu_reconfig_types {
+	NO_RECONFIG,
+	CONFIG_PATH,
+	CONFIG_SIZE,
+	CONFIG_WRITECACHE,
+};
+
 #endif
-- 
2.5.4 (Apple Git-61)

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 0/5] tcmu: Add Type of reconfig into netlink
  2017-06-06 14:28 [PATCH v4 0/5] tcmu: Add Type of reconfig into netlink Bryant G. Ly
                   ` (4 preceding siblings ...)
  2017-06-06 14:28 ` [PATCH v4 5/5] tcmu: Add Type of reconfig into netlink Bryant G. Ly
@ 2017-06-09  6:11 ` Nicholas A. Bellinger
  2017-06-11 21:02   ` Mike Christie
  5 siblings, 1 reply; 12+ messages in thread
From: Nicholas A. Bellinger @ 2017-06-09  6:11 UTC (permalink / raw)
  To: Bryant G. Ly; +Cc: mchristi, seroyer, linux-scsi, target-devel, Bryant G. Ly

Hi Bryant & Co,

On Tue, 2017-06-06 at 09:28 -0500, Bryant G. Ly wrote:
> From: "Bryant G. Ly" <bgly@us.ibm.com>
> 
> This patch consists of adding a netlink to allow for reconfiguration
> of a device in tcmu.
> 
> It also changes and adds some attributes that are reconfigurable:
> write_cache, device size, and device path.
> 
> V2 - Fixes kfree in tcmu: Make dev_config configurable
> V3 - Fixes spelling error
> V4 - change strcpy to strlcpy for tcmu_dev_path_store and move
>      tcmu_reconfig_type into target_core_user.h
> 
> 
> Bryant G. Ly (5):
>   tcmu: Support emulate_write_cache
>   tcmu: Add netlink for device reconfiguration
>   tcmu: Make dev_size configurable via userspace
>   tcmu: Make dev_config configurable
>   tcmu: Add Type of reconfig into netlink
> 
>  drivers/target/target_core_user.c     | 152 ++++++++++++++++++++++++++++++++--
>  include/uapi/linux/target_core_user.h |   9 ++
>  2 files changed, 155 insertions(+), 6 deletions(-)
> 

AFAICT, it looks like all of the review comments have been addressed in
-v4.

Applied to target-pending/for-next, with MNC's (pseudo) Reviewed-by's
added for #3-#5.

Please let me know if anything else needs to be changed.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 0/5] tcmu: Add Type of reconfig into netlink
  2017-06-09  6:11 ` [PATCH v4 0/5] " Nicholas A. Bellinger
@ 2017-06-11 21:02   ` Mike Christie
  2017-06-12  6:43     ` Mike Christie
  0 siblings, 1 reply; 12+ messages in thread
From: Mike Christie @ 2017-06-11 21:02 UTC (permalink / raw)
  To: Nicholas A. Bellinger, Bryant G. Ly
  Cc: seroyer, linux-scsi, target-devel, Bryant G. Ly

[-- Attachment #1: Type: text/plain, Size: 1563 bytes --]

On 06/09/2017 01:11 AM, Nicholas A. Bellinger wrote:
> Hi Bryant & Co,
> 
> On Tue, 2017-06-06 at 09:28 -0500, Bryant G. Ly wrote:
>> From: "Bryant G. Ly" <bgly@us.ibm.com>
>>
>> This patch consists of adding a netlink to allow for reconfiguration
>> of a device in tcmu.
>>
>> It also changes and adds some attributes that are reconfigurable:
>> write_cache, device size, and device path.
>>
>> V2 - Fixes kfree in tcmu: Make dev_config configurable
>> V3 - Fixes spelling error
>> V4 - change strcpy to strlcpy for tcmu_dev_path_store and move
>>      tcmu_reconfig_type into target_core_user.h
>>
>>
>> Bryant G. Ly (5):
>>   tcmu: Support emulate_write_cache
>>   tcmu: Add netlink for device reconfiguration
>>   tcmu: Make dev_size configurable via userspace
>>   tcmu: Make dev_config configurable
>>   tcmu: Add Type of reconfig into netlink
>>
>>  drivers/target/target_core_user.c     | 152 ++++++++++++++++++++++++++++++++--
>>  include/uapi/linux/target_core_user.h |   9 ++
>>  2 files changed, 155 insertions(+), 6 deletions(-)
>>
> 
> AFAICT, it looks like all of the review comments have been addressed in
> -v4.
> 
> Applied to target-pending/for-next, with MNC's (pseudo) Reviewed-by's
> added for #3-#5.
> 
> Please let me know if anything else needs to be changed.
> 

The patches look ok. Thanks. Could you just merge the attached patch
into "[PATCH v4 5/5] tcmu: Add Type of reconfig into netlink" or into
the patchset after it? It just makes some of the names a little less
generic and only returns the reconfig attr for reconfig commands.

[-- Attachment #2: 0001-tcmu-reconfigure-netlink-attr-changes.patch --]
[-- Type: text/x-patch, Size: 3624 bytes --]

>From b51f9b228490ba61306060460164aed8f2e8fc8b Mon Sep 17 00:00:00 2001
From: Mike Christie <mchristi@redhat.com>
Date: Sun, 11 Jun 2017 15:59:25 -0500
Subject: [PATCH 1/1] tcmu: reconfigure netlink attr changes

1. TCMU_ATTR_TYPE is too generic when it describes only the
reconfiguration type, so rename to TCMU_ATTR_RECONFIG_TYPE.

2. Only return the reconfig type when it is a TCMU_CMD_RECONFIG_DEVICE
command.

3. CONFIG_* is probably too generic, so add a TCMU_* prefix.

Signed-off-by: Mike Christie <mchristi@redhat.com>
---
 drivers/target/target_core_user.c     | 20 ++++++++++++--------
 include/uapi/linux/target_core_user.h | 10 +++++-----
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index afc1fd6..3a50b8c 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1199,9 +1199,11 @@ static int tcmu_netlink_event(enum tcmu_genl_cmd cmd, const char *name,
 	if (ret < 0)
 		goto free_skb;
 
-	ret = nla_put_u32(skb, TCMU_ATTR_TYPE, type);
-	if (ret < 0)
-		goto free_skb;
+	if (cmd == TCMU_CMD_RECONFIG_DEVICE) {
+		ret = nla_put_u32(skb, TCMU_ATTR_RECONFIG_TYPE, type);
+		if (ret < 0)
+			goto free_skb;
+	}
 
 	genlmsg_end(skb, msg_header);
 
@@ -1306,7 +1308,8 @@ static int tcmu_configure_device(struct se_device *dev)
 	kref_get(&udev->kref);
 
 	ret = tcmu_netlink_event(TCMU_CMD_ADDED_DEVICE, udev->uio_info.name,
-				 udev->uio_info.uio_dev->minor, NO_RECONFIG);
+				 udev->uio_info.uio_dev->minor,
+				 TCMU_CONFIG_NONE);
 	if (ret)
 		goto err_netlink;
 
@@ -1388,7 +1391,8 @@ static void tcmu_free_device(struct se_device *dev)
 
 	if (tcmu_dev_configured(udev)) {
 		tcmu_netlink_event(TCMU_CMD_REMOVED_DEVICE, udev->uio_info.name,
-				   udev->uio_info.uio_dev->minor, NO_RECONFIG);
+				   udev->uio_info.uio_dev->minor,
+				   TCMU_CONFIG_NONE);
 
 		uio_unregister_device(&udev->uio_info);
 	}
@@ -1583,7 +1587,7 @@ static ssize_t tcmu_dev_path_store(struct config_item *item, const char *page,
 		ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE,
 					 udev->uio_info.name,
 					 udev->uio_info.uio_dev->minor,
-					 CONFIG_PATH);
+					 TCMU_CONFIG_PATH);
 		if (ret) {
 			pr_err("Unable to reconfigure device\n");
 			return ret;
@@ -1622,7 +1626,7 @@ static ssize_t tcmu_dev_size_store(struct config_item *item, const char *page,
 		ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE,
 					 udev->uio_info.name,
 					 udev->uio_info.uio_dev->minor,
-					 CONFIG_SIZE);
+					 TCMU_CONFIG_SIZE);
 		if (ret) {
 			pr_err("Unable to reconfigure device\n");
 			return ret;
@@ -1662,7 +1666,7 @@ static ssize_t tcmu_emulate_write_cache_store(struct config_item *item,
 		ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE,
 					 udev->uio_info.name,
 					 udev->uio_info.uio_dev->minor,
-					 CONFIG_WRITECACHE);
+					 TCMU_CONFIG_WRITECACHE);
 		if (ret) {
 			pr_err("Unable to reconfigure device\n");
 			return ret;
diff --git a/include/uapi/linux/target_core_user.h b/include/uapi/linux/target_core_user.h
index 5b00e35..b14ddf9 100644
--- a/include/uapi/linux/target_core_user.h
+++ b/include/uapi/linux/target_core_user.h
@@ -139,16 +139,16 @@ enum tcmu_genl_attr {
 	TCMU_ATTR_UNSPEC,
 	TCMU_ATTR_DEVICE,
 	TCMU_ATTR_MINOR,
-	TCMU_ATTR_TYPE,
+	TCMU_ATTR_RECONFIG_TYPE,
 	__TCMU_ATTR_MAX,
 };
 #define TCMU_ATTR_MAX (__TCMU_ATTR_MAX - 1)
 
 enum tcmu_reconfig_types {
-	NO_RECONFIG,
-	CONFIG_PATH,
-	CONFIG_SIZE,
-	CONFIG_WRITECACHE,
+	TCMU_CONFIG_NONE,
+	TCMU_CONFIG_PATH,
+	TCMU_CONFIG_SIZE,
+	TCMU_CONFIG_WRITECACHE,
 };
 
 #endif
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 0/5] tcmu: Add Type of reconfig into netlink
  2017-06-11 21:02   ` Mike Christie
@ 2017-06-12  6:43     ` Mike Christie
  2017-06-30  7:31       ` Nicholas A. Bellinger
  0 siblings, 1 reply; 12+ messages in thread
From: Mike Christie @ 2017-06-12  6:43 UTC (permalink / raw)
  To: Nicholas A. Bellinger, Bryant G. Ly
  Cc: seroyer, linux-scsi, target-devel, Bryant G. Ly

[-- Attachment #1: Type: text/plain, Size: 2124 bytes --]

On 06/11/2017 04:02 PM, Mike Christie wrote:
> On 06/09/2017 01:11 AM, Nicholas A. Bellinger wrote:
>> Hi Bryant & Co,
>>
>> On Tue, 2017-06-06 at 09:28 -0500, Bryant G. Ly wrote:
>>> From: "Bryant G. Ly" <bgly@us.ibm.com>
>>>
>>> This patch consists of adding a netlink to allow for reconfiguration
>>> of a device in tcmu.
>>>
>>> It also changes and adds some attributes that are reconfigurable:
>>> write_cache, device size, and device path.
>>>
>>> V2 - Fixes kfree in tcmu: Make dev_config configurable
>>> V3 - Fixes spelling error
>>> V4 - change strcpy to strlcpy for tcmu_dev_path_store and move
>>>      tcmu_reconfig_type into target_core_user.h
>>>
>>>
>>> Bryant G. Ly (5):
>>>   tcmu: Support emulate_write_cache
>>>   tcmu: Add netlink for device reconfiguration
>>>   tcmu: Make dev_size configurable via userspace
>>>   tcmu: Make dev_config configurable
>>>   tcmu: Add Type of reconfig into netlink
>>>
>>>  drivers/target/target_core_user.c     | 152 ++++++++++++++++++++++++++++++++--
>>>  include/uapi/linux/target_core_user.h |   9 ++
>>>  2 files changed, 155 insertions(+), 6 deletions(-)
>>>
>>
>> AFAICT, it looks like all of the review comments have been addressed in
>> -v4.
>>
>> Applied to target-pending/for-next, with MNC's (pseudo) Reviewed-by's
>> added for #3-#5.
>>
>> Please let me know if anything else needs to be changed.
>>
> 
> The patches look ok. Thanks. Could you just merge the attached patch
> into "[PATCH v4 5/5] tcmu: Add Type of reconfig into netlink" or into
> the patchset after it? It just makes some of the names a little less
> generic and only returns the reconfig attr for reconfig commands.
> 

Actually Nick, do not merge the last patch. I have a lot more fixes/changes.

Bryant, could you test and adapt your userspace patches for the attached
patch build over Nicks for-next branch.

Basically, the patch just has use pass the value being reconfigured with
the netlink event. Along the way, it fixes a couple bugs.

Nick, when we have tested the patch, then I can submit as a formal
patchset, or you can fold into the existing patches or whatever you prefer.


[-- Attachment #2: 0001-tcmu-reconfigure-netlink-attr-changes.patch --]
[-- Type: text/x-patch, Size: 7087 bytes --]

>From dad38c89d92a83b19b285431268818a74fe48fab Mon Sep 17 00:00:00 2001
From: Mike Christie <mchristi@redhat.com>
Date: Mon, 12 Jun 2017 01:34:28 -0500
Subject: [PATCH 1/1] tcmu: reconfigure netlink attr changes v2

1. TCMU_ATTR_TYPE is too generic. Drop it and use per reconfig
type attrs.

2. Only return the reconfig type when it is a TCMU_CMD_RECONFIG_DEVICE command.

3. CONFIG_* type is not needed. We can pass the value along with an
ATTR to userspace, so it does not need to read sysfs/configfs.

4. Fix leak in tcmu_dev_path_store and rename to dev_config to
reflect it is more than just a path that can be changed.

6. Don't update kernel struct value if netlink sending fails.

Signed-off-by: Mike Christie <mchristi@redhat.com>
---
 drivers/target/target_core_user.c     | 73 +++++++++++++++++++++--------------
 include/uapi/linux/target_core_user.h | 12 ++----
 2 files changed, 48 insertions(+), 37 deletions(-)

diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index afc1fd6..1712c42 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1177,7 +1177,8 @@ static int tcmu_release(struct uio_info *info, struct inode *inode)
 }
 
 static int tcmu_netlink_event(enum tcmu_genl_cmd cmd, const char *name,
-			      int minor, int type)
+			      int minor, int reconfig_attr,
+			      const void *reconfig_data)
 {
 	struct sk_buff *skb;
 	void *msg_header;
@@ -1199,9 +1200,27 @@ static int tcmu_netlink_event(enum tcmu_genl_cmd cmd, const char *name,
 	if (ret < 0)
 		goto free_skb;
 
-	ret = nla_put_u32(skb, TCMU_ATTR_TYPE, type);
-	if (ret < 0)
-		goto free_skb;
+	if (cmd == TCMU_CMD_RECONFIG_DEVICE) {
+		switch (reconfig_attr) {
+		case TCMU_ATTR_DEV_CFG:
+			ret = nla_put_string(skb, reconfig_attr, reconfig_data);
+			break;
+		case TCMU_ATTR_DEV_SIZE:
+			ret = nla_put_u64_64bit(skb, reconfig_attr,
+						*((u64 *)reconfig_data),
+						TCMU_ATTR_PAD);
+			break;
+		case TCMU_ATTR_WRITECACHE:
+			ret = nla_put_u8(skb, reconfig_attr,
+					  *((u8 *)reconfig_data));
+			break;
+		default:
+			BUG();
+		}
+
+		if (ret < 0)
+			goto free_skb;
+	}
 
 	genlmsg_end(skb, msg_header);
 
@@ -1306,7 +1325,7 @@ static int tcmu_configure_device(struct se_device *dev)
 	kref_get(&udev->kref);
 
 	ret = tcmu_netlink_event(TCMU_CMD_ADDED_DEVICE, udev->uio_info.name,
-				 udev->uio_info.uio_dev->minor, NO_RECONFIG);
+				 udev->uio_info.uio_dev->minor, 0, NULL);
 	if (ret)
 		goto err_netlink;
 
@@ -1388,7 +1407,7 @@ static void tcmu_free_device(struct se_device *dev)
 
 	if (tcmu_dev_configured(udev)) {
 		tcmu_netlink_event(TCMU_CMD_REMOVED_DEVICE, udev->uio_info.name,
-				   udev->uio_info.uio_dev->minor, NO_RECONFIG);
+				   udev->uio_info.uio_dev->minor, 0, NULL);
 
 		uio_unregister_device(&udev->uio_info);
 	}
@@ -1553,7 +1572,7 @@ static ssize_t tcmu_cmd_time_out_store(struct config_item *item, const char *pag
 }
 CONFIGFS_ATTR(tcmu_, cmd_time_out);
 
-static ssize_t tcmu_dev_path_show(struct config_item *item, char *page)
+static ssize_t tcmu_dev_config_show(struct config_item *item, char *page)
 {
 	struct se_dev_attrib *da = container_of(to_config_group(item),
 						struct se_dev_attrib, da_group);
@@ -1562,37 +1581,34 @@ static ssize_t tcmu_dev_path_show(struct config_item *item, char *page)
 	return snprintf(page, PAGE_SIZE, "%s\n", udev->dev_config);
 }
 
-static ssize_t tcmu_dev_path_store(struct config_item *item, const char *page,
-				   size_t count)
+static ssize_t tcmu_dev_config_store(struct config_item *item, const char *page,
+				     size_t count)
 {
 	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);
-	char *copy = NULL;
-	int ret;
+	int ret, len;
 
-	copy = kstrdup(page, GFP_KERNEL);
-	if (!copy) {
-		kfree(copy);
+	len = strlen(page);
+	if (!len || len > TCMU_CONFIG_LEN - 1)
 		return -EINVAL;
-	}
-	strlcpy(udev->dev_config, copy, TCMU_CONFIG_LEN);
 
 	/* 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,
-					 CONFIG_PATH);
+					 TCMU_ATTR_DEV_CFG, page);
 		if (ret) {
 			pr_err("Unable to reconfigure device\n");
 			return ret;
 		}
 	}
+	strlcpy(udev->dev_config, page, TCMU_CONFIG_LEN);
 
 	return count;
 }
-CONFIGFS_ATTR(tcmu_, dev_path);
+CONFIGFS_ATTR(tcmu_, dev_config);
 
 static ssize_t tcmu_dev_size_show(struct config_item *item, char *page)
 {
@@ -1609,26 +1625,25 @@ static ssize_t tcmu_dev_size_store(struct config_item *item, const char *page,
 	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);
-	unsigned long val;
+	u64 val;
 	int ret;
 
-	ret = kstrtoul(page, 0, &val);
+	ret = kstrtou64(page, 0, &val);
 	if (ret < 0)
 		return ret;
-	udev->dev_size = 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,
-					 CONFIG_SIZE);
+					 TCMU_ATTR_DEV_SIZE, &val);
 		if (ret) {
 			pr_err("Unable to reconfigure device\n");
 			return ret;
 		}
 	}
-
+	udev->dev_size = val;
 	return count;
 }
 CONFIGFS_ATTR(tcmu_, dev_size);
@@ -1648,33 +1663,33 @@ 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;
+	u8 val;
 	int ret;
 
-	ret = kstrtouint(page, 0, &val);
+	ret = kstrtou8(page, 0, &val);
 	if (ret < 0)
 		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,
-					 CONFIG_WRITECACHE);
+					 TCMU_ATTR_WRITECACHE, &val);
 		if (ret) {
 			pr_err("Unable to reconfigure device\n");
 			return ret;
 		}
 	}
+
+	da->emulate_write_cache = val;
 	return count;
 }
 CONFIGFS_ATTR(tcmu_, emulate_write_cache);
 
 struct configfs_attribute *tcmu_attrib_attrs[] = {
 	&tcmu_attr_cmd_time_out,
-	&tcmu_attr_dev_path,
+	&tcmu_attr_dev_config,
 	&tcmu_attr_dev_size,
 	&tcmu_attr_emulate_write_cache,
 	NULL,
diff --git a/include/uapi/linux/target_core_user.h b/include/uapi/linux/target_core_user.h
index 5b00e35..4bfc9a1 100644
--- a/include/uapi/linux/target_core_user.h
+++ b/include/uapi/linux/target_core_user.h
@@ -139,16 +139,12 @@ enum tcmu_genl_attr {
 	TCMU_ATTR_UNSPEC,
 	TCMU_ATTR_DEVICE,
 	TCMU_ATTR_MINOR,
-	TCMU_ATTR_TYPE,
+	TCMU_ATTR_PAD,
+	TCMU_ATTR_DEV_CFG,
+	TCMU_ATTR_DEV_SIZE,
+	TCMU_ATTR_WRITECACHE,
 	__TCMU_ATTR_MAX,
 };
 #define TCMU_ATTR_MAX (__TCMU_ATTR_MAX - 1)
 
-enum tcmu_reconfig_types {
-	NO_RECONFIG,
-	CONFIG_PATH,
-	CONFIG_SIZE,
-	CONFIG_WRITECACHE,
-};
-
 #endif
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 0/5] tcmu: Add Type of reconfig into netlink
  2017-06-12  6:43     ` Mike Christie
@ 2017-06-30  7:31       ` Nicholas A. Bellinger
  2017-06-30 16:58         ` Mike Christie
  0 siblings, 1 reply; 12+ messages in thread
From: Nicholas A. Bellinger @ 2017-06-30  7:31 UTC (permalink / raw)
  To: Mike Christie
  Cc: Bryant G. Ly, seroyer, linux-scsi, target-devel, Bryant G. Ly

Hey MNC,

On Mon, 2017-06-12 at 01:43 -0500, Mike Christie wrote:
> On 06/11/2017 04:02 PM, Mike Christie wrote:
> > On 06/09/2017 01:11 AM, Nicholas A. Bellinger wrote:
> >> Hi Bryant & Co,
> >>
> >> On Tue, 2017-06-06 at 09:28 -0500, Bryant G. Ly wrote:
> >>> From: "Bryant G. Ly" <bgly@us.ibm.com>
> >>>
> >>> This patch consists of adding a netlink to allow for reconfiguration
> >>> of a device in tcmu.
> >>>
> >>> It also changes and adds some attributes that are reconfigurable:
> >>> write_cache, device size, and device path.
> >>>
> >>> V2 - Fixes kfree in tcmu: Make dev_config configurable
> >>> V3 - Fixes spelling error
> >>> V4 - change strcpy to strlcpy for tcmu_dev_path_store and move
> >>>      tcmu_reconfig_type into target_core_user.h
> >>>
> >>>
> >>> Bryant G. Ly (5):
> >>>   tcmu: Support emulate_write_cache
> >>>   tcmu: Add netlink for device reconfiguration
> >>>   tcmu: Make dev_size configurable via userspace
> >>>   tcmu: Make dev_config configurable
> >>>   tcmu: Add Type of reconfig into netlink
> >>>
> >>>  drivers/target/target_core_user.c     | 152 ++++++++++++++++++++++++++++++++--
> >>>  include/uapi/linux/target_core_user.h |   9 ++
> >>>  2 files changed, 155 insertions(+), 6 deletions(-)
> >>>
> >>
> >> AFAICT, it looks like all of the review comments have been addressed in
> >> -v4.
> >>
> >> Applied to target-pending/for-next, with MNC's (pseudo) Reviewed-by's
> >> added for #3-#5.
> >>
> >> Please let me know if anything else needs to be changed.
> >>
> > 
> > The patches look ok. Thanks. Could you just merge the attached patch
> > into "[PATCH v4 5/5] tcmu: Add Type of reconfig into netlink" or into
> > the patchset after it? It just makes some of the names a little less
> > generic and only returns the reconfig attr for reconfig commands.
> > 
> 
> Actually Nick, do not merge the last patch. I have a lot more fixes/changes.
> 
> Bryant, could you test and adapt your userspace patches for the attached
> patch build over Nicks for-next branch.
> 
> Basically, the patch just has use pass the value being reconfigured with
> the netlink event. Along the way, it fixes a couple bugs.
> 
> Nick, when we have tested the patch, then I can submit as a formal
> patchset, or you can fold into the existing patches or whatever you prefer.
> 

Looking at merging your -v4 patches series here next:

[PATCH V4 00/10] target/tcmu: make tcmu netlink ops sync
http://www.spinics.net/lists/target-devel/msg15706.html

Do you still want me to drop the patch from Bryant below as mentioned
earlier..?

tcmu: Add Type of reconfig into netlink
https://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git/commit/?h=for-next&id=28d44b983000754677155e46f6bdafc7b4d84213

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 0/5] tcmu: Add Type of reconfig into netlink
  2017-06-30  7:31       ` Nicholas A. Bellinger
@ 2017-06-30 16:58         ` Mike Christie
  2017-06-30 17:51           ` Mike Christie
  0 siblings, 1 reply; 12+ messages in thread
From: Mike Christie @ 2017-06-30 16:58 UTC (permalink / raw)
  To: Nicholas A. Bellinger
  Cc: Bryant G. Ly, seroyer, linux-scsi, target-devel, Bryant G. Ly

On 06/30/2017 02:31 AM, Nicholas A. Bellinger wrote:
> Hey MNC,
> 
> On Mon, 2017-06-12 at 01:43 -0500, Mike Christie wrote:
>> On 06/11/2017 04:02 PM, Mike Christie wrote:
>>> On 06/09/2017 01:11 AM, Nicholas A. Bellinger wrote:
>>>> Hi Bryant & Co,
>>>>
>>>> On Tue, 2017-06-06 at 09:28 -0500, Bryant G. Ly wrote:
>>>>> From: "Bryant G. Ly" <bgly@us.ibm.com>
>>>>>
>>>>> This patch consists of adding a netlink to allow for reconfiguration
>>>>> of a device in tcmu.
>>>>>
>>>>> It also changes and adds some attributes that are reconfigurable:
>>>>> write_cache, device size, and device path.
>>>>>
>>>>> V2 - Fixes kfree in tcmu: Make dev_config configurable
>>>>> V3 - Fixes spelling error
>>>>> V4 - change strcpy to strlcpy for tcmu_dev_path_store and move
>>>>>      tcmu_reconfig_type into target_core_user.h
>>>>>
>>>>>
>>>>> Bryant G. Ly (5):
>>>>>   tcmu: Support emulate_write_cache
>>>>>   tcmu: Add netlink for device reconfiguration
>>>>>   tcmu: Make dev_size configurable via userspace
>>>>>   tcmu: Make dev_config configurable
>>>>>   tcmu: Add Type of reconfig into netlink
>>>>>
>>>>>  drivers/target/target_core_user.c     | 152 ++++++++++++++++++++++++++++++++--
>>>>>  include/uapi/linux/target_core_user.h |   9 ++
>>>>>  2 files changed, 155 insertions(+), 6 deletions(-)
>>>>>
>>>>
>>>> AFAICT, it looks like all of the review comments have been addressed in
>>>> -v4.
>>>>
>>>> Applied to target-pending/for-next, with MNC's (pseudo) Reviewed-by's
>>>> added for #3-#5.
>>>>
>>>> Please let me know if anything else needs to be changed.
>>>>
>>>
>>> The patches look ok. Thanks. Could you just merge the attached patch
>>> into "[PATCH v4 5/5] tcmu: Add Type of reconfig into netlink" or into
>>> the patchset after it? It just makes some of the names a little less
>>> generic and only returns the reconfig attr for reconfig commands.
>>>
>>
>> Actually Nick, do not merge the last patch. I have a lot more fixes/changes.
>>
>> Bryant, could you test and adapt your userspace patches for the attached
>> patch build over Nicks for-next branch.
>>
>> Basically, the patch just has use pass the value being reconfigured with
>> the netlink event. Along the way, it fixes a couple bugs.
>>
>> Nick, when we have tested the patch, then I can submit as a formal
>> patchset, or you can fold into the existing patches or whatever you prefer.
>>
> 
> Looking at merging your -v4 patches series here next:
> 
> [PATCH V4 00/10] target/tcmu: make tcmu netlink ops sync
> http://www.spinics.net/lists/target-devel/msg15706.html
> 
> Do you still want me to drop the patch from Bryant below as mentioned
> earlier..?

Hey,

First, sorry for the mess of comments/patches in various threads.

No need to drop it. The first patch:

[PATCH 01/10] tcmu: reconfigure netlink attr changes

in the thread you referenced above just fixes the stuff that needed to
be fixed.


> 
> tcmu: Add Type of reconfig into netlink
> https://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git/commit/?h=for-next&id=28d44b983000754677155e46f6bdafc7b4d84213
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 0/5] tcmu: Add Type of reconfig into netlink
  2017-06-30 16:58         ` Mike Christie
@ 2017-06-30 17:51           ` Mike Christie
  0 siblings, 0 replies; 12+ messages in thread
From: Mike Christie @ 2017-06-30 17:51 UTC (permalink / raw)
  To: Nicholas A. Bellinger
  Cc: Bryant G. Ly, seroyer, linux-scsi, target-devel, Bryant G. Ly

On 06/30/2017 11:58 AM, Mike Christie wrote:
> On 06/30/2017 02:31 AM, Nicholas A. Bellinger wrote:
>> Hey MNC,
>>
>> On Mon, 2017-06-12 at 01:43 -0500, Mike Christie wrote:
>>> On 06/11/2017 04:02 PM, Mike Christie wrote:
>>>> On 06/09/2017 01:11 AM, Nicholas A. Bellinger wrote:
>>>>> Hi Bryant & Co,
>>>>>
>>>>> On Tue, 2017-06-06 at 09:28 -0500, Bryant G. Ly wrote:
>>>>>> From: "Bryant G. Ly" <bgly@us.ibm.com>
>>>>>>
>>>>>> This patch consists of adding a netlink to allow for reconfiguration
>>>>>> of a device in tcmu.
>>>>>>
>>>>>> It also changes and adds some attributes that are reconfigurable:
>>>>>> write_cache, device size, and device path.
>>>>>>
>>>>>> V2 - Fixes kfree in tcmu: Make dev_config configurable
>>>>>> V3 - Fixes spelling error
>>>>>> V4 - change strcpy to strlcpy for tcmu_dev_path_store and move
>>>>>>      tcmu_reconfig_type into target_core_user.h
>>>>>>
>>>>>>
>>>>>> Bryant G. Ly (5):
>>>>>>   tcmu: Support emulate_write_cache
>>>>>>   tcmu: Add netlink for device reconfiguration
>>>>>>   tcmu: Make dev_size configurable via userspace
>>>>>>   tcmu: Make dev_config configurable
>>>>>>   tcmu: Add Type of reconfig into netlink
>>>>>>
>>>>>>  drivers/target/target_core_user.c     | 152 ++++++++++++++++++++++++++++++++--
>>>>>>  include/uapi/linux/target_core_user.h |   9 ++
>>>>>>  2 files changed, 155 insertions(+), 6 deletions(-)
>>>>>>
>>>>>
>>>>> AFAICT, it looks like all of the review comments have been addressed in
>>>>> -v4.
>>>>>
>>>>> Applied to target-pending/for-next, with MNC's (pseudo) Reviewed-by's
>>>>> added for #3-#5.
>>>>>
>>>>> Please let me know if anything else needs to be changed.
>>>>>
>>>>
>>>> The patches look ok. Thanks. Could you just merge the attached patch
>>>> into "[PATCH v4 5/5] tcmu: Add Type of reconfig into netlink" or into
>>>> the patchset after it? It just makes some of the names a little less
>>>> generic and only returns the reconfig attr for reconfig commands.
>>>>
>>>
>>> Actually Nick, do not merge the last patch. I have a lot more fixes/changes.
>>>
>>> Bryant, could you test and adapt your userspace patches for the attached
>>> patch build over Nicks for-next branch.
>>>
>>> Basically, the patch just has use pass the value being reconfigured with
>>> the netlink event. Along the way, it fixes a couple bugs.
>>>
>>> Nick, when we have tested the patch, then I can submit as a formal
>>> patchset, or you can fold into the existing patches or whatever you prefer.
>>>
>>
>> Looking at merging your -v4 patches series here next:
>>
>> [PATCH V4 00/10] target/tcmu: make tcmu netlink ops sync
>> http://www.spinics.net/lists/target-devel/msg15706.html
>>
>> Do you still want me to drop the patch from Bryant below as mentioned
>> earlier..?
> 
> Hey,
> 
> First, sorry for the mess of comments/patches in various threads.
> 
> No need to drop it. The first patch:

Oh wait. Just to make sure I understood you correctly. I meant you do
not need to drop any of Bryant's patches. But, the patches:

https://www.spinics.net/lists/target-devel/msg15593.html
https://www.spinics.net/lists/target-devel/msg15595.html

I sent in Bryant's thread "[PATCH v4 0/5] tcmu: Add Type of reconfig
into netlink" do not need to be applied. The patch "[PATCH 01/10] tcmu:
reconfigure netlink attr changes" in my patchset you referenced "[PATCH
V4 00/10] target/tcmu: make tcmu netlink ops sync" is the correct up to
date patch.


> 
> [PATCH 01/10] tcmu: reconfigure netlink attr changes
> 
> in the thread you referenced above just fixes the stuff that needed to
> be fixed.
> 
> 
>>
>> tcmu: Add Type of reconfig into netlink
>> https://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git/commit/?h=for-next&id=28d44b983000754677155e46f6bdafc7b4d84213
>>
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-06-30 17:51 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-06 14:28 [PATCH v4 0/5] tcmu: Add Type of reconfig into netlink Bryant G. Ly
2017-06-06 14:28 ` [PATCH v4 1/5] tcmu: Support emulate_write_cache Bryant G. Ly
2017-06-06 14:28 ` [PATCH v4 2/5] tcmu: Add netlink for device reconfiguration Bryant G. Ly
2017-06-06 14:28 ` [PATCH v4 3/5] tcmu: Make dev_size configurable via userspace Bryant G. Ly
2017-06-06 14:28 ` [PATCH v4 4/5] tcmu: Make dev_config configurable Bryant G. Ly
2017-06-06 14:28 ` [PATCH v4 5/5] tcmu: Add Type of reconfig into netlink Bryant G. Ly
2017-06-09  6:11 ` [PATCH v4 0/5] " Nicholas A. Bellinger
2017-06-11 21:02   ` Mike Christie
2017-06-12  6:43     ` Mike Christie
2017-06-30  7:31       ` Nicholas A. Bellinger
2017-06-30 16:58         ` Mike Christie
2017-06-30 17:51           ` Mike Christie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).