Skip to contentSkip to conversation

bus/vdev: add warning for duplicated vdev name

PATCH In review Yahui Cao 3 participants 4 messages Nov 29, 2018 – Jun 10, 2023

lore
Share & tools
lore

Yahui Cao

author
#0 lore raw

PATCH 1/1 bus/vdev: add warning for duplicated vdev name

If duplicated vdev name is detected, print out a warning message.

---
 drivers/bus/vdev/vdev.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/bus/vdev/vdev.c +2 -0
index 9c66bdc78..ff2db7d3f 100644
@@ -462,6 +462,8 @@ vdev_scan(void)
 		if (find_vdev(devargs->name)) {
 			rte_spinlock_recursive_unlock(&vdev_device_list_lock);
 			free(dev);
+			VDEV_LOG(WARNING, "duplicated vdev name %s detected!",
+				devargs->name);
 			continue;
 		}
 
Signature · 1 line
2.17.1
#1 lore raw

29/11/2018 08:16, Yahui Cao:

Quoted 12 lines

If duplicated vdev name is detected, print out a warning message.

---
 drivers/bus/vdev/vdev.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/bus/vdev/vdev.c +0 -0
index 9c66bdc78..ff2db7d3f 100644

drivers/bus/vdev/vdev.c vdev_scan(void) · line 468

Quoted 7 lines
drivers/bus/vdev/vdev.c +2 -0
@@ -462,6 +462,8 @@ vdev_scan(void)
 		if (find_vdev(devargs->name)) {
 			rte_spinlock_recursive_unlock(&vdev_device_list_lock);
 			free(dev);
+			VDEV_LOG(WARNING, "duplicated vdev name %s detected!",
+				devargs->name);
 			continue;
 		}

I'm surprised there is nothing to prevent from creating 2 vdevs with the same name. It should be considered as an error and reject the vdev creation.

author
#2 lore raw
Quoted 8 lines · Thomas Monjalon

29/11/2018 08:16, Yahui Cao:

Quoted 7 lines

If duplicated vdev name is detected, print out a warning message.

---
 drivers/bus/vdev/vdev.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 18 lines

drivers/bus/vdev/vdev.c vdev_scan(void) · line 468

Quoted 12 lines
drivers/bus/vdev/vdev.c +2 -0
index 9c66bdc78..ff2db7d3f 100644
@@ -462,6 +462,8 @@ vdev_scan(void)
 		if (find_vdev(devargs->name)) {
 			rte_spinlock_recursive_unlock(&vdev_device_list_lock);
 			free(dev);
+			VDEV_LOG(WARNING, "duplicated vdev name %s detected!",
+				devargs->name);
 			continue;
 		}

I'm surprised there is nothing to prevent from creating 2 vdevs with the same name. It should be considered as an error and reject the vdev creation.

Actually it does skip the creation of vdev with the same name. Is it enough to return error from vdev_scan(), or even return error from rte_bus_scan()? Please give some advice.

#3 lore raw
In reply to Yahui Cao
Quoted 12 lines · On Thu, 29 Nov 2018 15:16:08 +0800 Yahui Cao <[email protected]> wrote:

If duplicated vdev name is detected, print out a warning message.

---
 drivers/bus/vdev/vdev.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/bus/vdev/vdev.c +0 -0
index 9c66bdc78..ff2db7d3f 100644

drivers/bus/vdev/vdev.c vdev_scan(void) · line 469

Quoted 8 lines
drivers/bus/vdev/vdev.c +2 -0
@@ -462,6 +462,8 @@ vdev_scan(void)
 		if (find_vdev(devargs->name)) {
 			rte_spinlock_recursive_unlock(&vdev_device_list_lock);
 			free(dev);
+			VDEV_LOG(WARNING, "duplicated vdev name %s detected!",
+				devargs->name);
 			continue;
 		}
 

Do you have an example of this?

It should be an error and have the scan fail.