Skip to contentSkip to conversation

bus/vdev: fix wrong error log on secondary device scan

PATCH In review Qi Zhang 4 participants 6 messages Aug 27, 2018 – Sep 16, 2018

lore
Share & tools
lore

Qi Zhang

author
#0 lore raw

PATCH 1/1 bus/vdev: fix wrong error log on secondary device scan

When a secondary process handles VDEV_SCAN_ONE mp action, it is possible the device is already be inserted. This happens when we have multiple secondary processes which cause multiple broadcasts from primary during bus->scan. So we don't need to log any error for -EEXIST.

Bugzilla ID: 84

Fixes cdb068f031c6 ("bus/vdev: scan by multi-process channel")
---
 drivers/bus/vdev/vdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/bus/vdev/vdev.c +5 -1
index 6139dd551..af9526fe6 100644
@@ -346,6 +346,7 @@ vdev_action(const struct rte_mp_msg *mp_msg, const void *peer)
 	const struct vdev_param *in = (const struct vdev_param *)mp_msg->param;
 	const char *devname;
 	int num;
+	int ret;
 
 	strlcpy(mp_resp.name, VDEV_MP_KEY, sizeof(mp_resp.name));
 	mp_resp.len_param = sizeof(*ou);
@@ -380,7 +381,10 @@ vdev_action(const struct rte_mp_msg *mp_msg, const void *peer)
 		break;
 	case VDEV_SCAN_ONE:
 		VDEV_LOG(INFO, "receive vdev, %s", in->name);
-		if (insert_vdev(in->name, NULL, NULL) < 0)
+		ret = insert_vdev(in->name, NULL, NULL);
+		if (ret == -EEXIST)
+			VDEV_LOG(INFO, "device already exist, %s", in->name);
+		else if (ret < 0)
 			VDEV_LOG(ERR, "failed to add vdev, %s", in->name);
 		break;
 	default:
Signature · 1 line
2.13.6
#1 lore raw
Quoted 28 lines · Qi Zhang

When a secondary process handles VDEV_SCAN_ONE mp action, it is possible the device is already be inserted. This happens when we have multiple secondary processes which cause multiple broadcasts from primary during bus->scan. So we don't need to log any error for -EEXIST.

Bugzilla ID: 84

Fixes cdb068f031c6 ("bus/vdev: scan by multi-process channel")
---
  drivers/bus/vdev/vdev.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
drivers/bus/vdev/vdev.c +1 -0
index 6139dd551..af9526fe6 100644
@@ -346,6 +346,7 @@ vdev_action(const struct rte_mp_msg *mp_msg, const void *peer)
  	const struct vdev_param *in = (const struct vdev_param *)mp_msg->param;
  	const char *devname;
  	int num;
+	int ret;
 
  	strlcpy(mp_resp.name, VDEV_MP_KEY, sizeof(mp_resp.name));
  	mp_resp.len_param = sizeof(*ou);

drivers/bus/vdev/vdev.c vdev_action(const struct rte_mp_msg *mp_msg, const void *peer) · line 386

Quoted 7 lines
drivers/bus/vdev/vdev.c +3 -1
@@ -380,7 +381,10 @@ vdev_action(const struct rte_mp_msg *mp_msg, const void *peer)
  		break;
  	case VDEV_SCAN_ONE:
  		VDEV_LOG(INFO, "receive vdev, %s", in->name);
-		if (insert_vdev(in->name, NULL, NULL) < 0)
+		ret = insert_vdev(in->name, NULL, NULL);
+		if (ret == -EEXIST)
+			VDEV_LOG(INFO, "device already exist, %s", in->name);

This is probably going to be printed a lot, and there's no real point in that. Maybe set log level to DEBUG instead?

Quoted 5 lines
drivers/bus/vdev/vdev.c +1 -0
+		else if (ret < 0)
  			VDEV_LOG(ERR, "failed to add vdev, %s", in->name);
  		break;
  	default:
Signature · 2 lines
Thanks,
Anatoly
author
#2 lore raw

PATCH 1/1 bus/vdev: fix wrong error log on secondary device scan

In reply to Qi Zhang

When a secondary process handles VDEV_SCAN_ONE mp action, it is possible the device is already be inserted. This happens when we have multiple secondary processes which cause multiple broadcasts from primary during bus->scan. So we don't need to log any error for -EEXIST.

Bugzilla ID: 84

Fixes cdb068f031c6 ("bus/vdev: scan by multi-process channel")

---

v2:
- change log level to DEBUG for the case device already exist.

 drivers/bus/vdev/vdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/bus/vdev/vdev.c +5 -1
index 6139dd551..69dee89a8 100644
@@ -346,6 +346,7 @@ vdev_action(const struct rte_mp_msg *mp_msg, const void *peer)
 	const struct vdev_param *in = (const struct vdev_param *)mp_msg->param;
 	const char *devname;
 	int num;
+	int ret;
 
 	strlcpy(mp_resp.name, VDEV_MP_KEY, sizeof(mp_resp.name));
 	mp_resp.len_param = sizeof(*ou);
@@ -380,7 +381,10 @@ vdev_action(const struct rte_mp_msg *mp_msg, const void *peer)
 		break;
 	case VDEV_SCAN_ONE:
 		VDEV_LOG(INFO, "receive vdev, %s", in->name);
-		if (insert_vdev(in->name, NULL, NULL) < 0)
+		ret = insert_vdev(in->name, NULL, NULL);
+		if (ret == -EEXIST)
+			VDEV_LOG(DEBUG, "device already exist, %s", in->name);
+		else if (ret < 0)
 			VDEV_LOG(ERR, "failed to add vdev, %s", in->name);
 		break;
 	default:
Signature · 1 line
2.13.6
author
#3 lore raw

PATCH v2 1/1 bus/vdev: fix wrong error log on secondary device scan

In reply to Qi Zhang

When a secondary process handles VDEV_SCAN_ONE mp action, it is possible the device is already be inserted. This happens when we have multiple secondary processes which cause multiple broadcasts from primary during bus->scan. So we don't need to log any error for -EEXIST.

Bugzilla ID: 84

Fixes cdb068f031c6 ("bus/vdev: scan by multi-process channel")

---

v2:
- change log level to DEBUG for the case device already exist.

 drivers/bus/vdev/vdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/bus/vdev/vdev.c +5 -1
index 6139dd551..69dee89a8 100644
@@ -346,6 +346,7 @@ vdev_action(const struct rte_mp_msg *mp_msg, const void *peer)
 	const struct vdev_param *in = (const struct vdev_param *)mp_msg->param;
 	const char *devname;
 	int num;
+	int ret;
 
 	strlcpy(mp_resp.name, VDEV_MP_KEY, sizeof(mp_resp.name));
 	mp_resp.len_param = sizeof(*ou);
@@ -380,7 +381,10 @@ vdev_action(const struct rte_mp_msg *mp_msg, const void *peer)
 		break;
 	case VDEV_SCAN_ONE:
 		VDEV_LOG(INFO, "receive vdev, %s", in->name);
-		if (insert_vdev(in->name, NULL, NULL) < 0)
+		ret = insert_vdev(in->name, NULL, NULL);
+		if (ret == -EEXIST)
+			VDEV_LOG(DEBUG, "device already exist, %s", in->name);
+		else if (ret < 0)
 			VDEV_LOG(ERR, "failed to add vdev, %s", in->name);
 		break;
 	default:
Signature · 1 line
2.13.6
Acked-by on v2 1/1
#4 lore raw

Thanks!
Gage

Quoted 58 lines

-----Original Message-----
From: Zhang, Qi Z
Sent: Monday, September 3, 2018 3:50 AM
To: [email protected]
Cc: [email protected]; Burakov, Anatoly <[email protected]>; Eads, Gage <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]
Subject: [PATCH v2] bus/vdev: fix wrong error log on secondary device scan

When a secondary process handles VDEV_SCAN_ONE mp action, it is possible the device is already be inserted. This happens when we have multiple secondary processes which cause multiple broadcasts from primary during bus->scan. So we don't need to log any error for -EEXIST.

Bugzilla ID: 84

Fixes cdb068f031c6 ("bus/vdev: scan by multi-process channel")

---

v2:
- change log level to DEBUG for the case device already exist.

 drivers/bus/vdev/vdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/bus/vdev/vdev.c index renamed from drivers/bus/vdev/vdev.c +0 -0

6139dd551..69dee89a8 100644

drivers/bus/vdev/vdev.c +1 -0
@@ -346,6 +346,7 @@ vdev_action(const struct rte_mp_msg *mp_msg, const
 void *peer)
 	const struct vdev_param *in = (const struct vdev_param *)mp_msg-
 >param;
 	const char *devname;
 	int num;
+	int ret;
 
drivers/bus/vdev/vdev.c +4 -1
 	strlcpy(mp_resp.name, VDEV_MP_KEY, sizeof(mp_resp.name));
 	mp_resp.len_param = sizeof(*ou);
@@ -380,7 +381,10 @@ vdev_action(const struct rte_mp_msg *mp_msg, const
 void *peer)
 		break;
 	case VDEV_SCAN_ONE:
 		VDEV_LOG(INFO, "receive vdev, %s", in->name);
-		if (insert_vdev(in->name, NULL, NULL) < 0)
+		ret = insert_vdev(in->name, NULL, NULL);
+		if (ret == -EEXIST)
+			VDEV_LOG(DEBUG, "device already exist, %s", in-
 >name);
+		else if (ret < 0)
 			VDEV_LOG(ERR, "failed to add vdev, %s", in->name);
drivers/bus/vdev/vdev.c +0 -1
 		break;
 	default:
--

2.13.6

#5 lore raw
Quoted 5 lines
Quoted 5 lines

When a secondary process handles VDEV_SCAN_ONE mp action, it is possible the device is already be inserted. This happens when we have multiple secondary processes which cause multiple broadcasts from primary during bus->scan. So we don't need to log any error for -EEXIST.

Quoted 7 lines
Quoted 6 lines

Bugzilla ID: 84

Fixes cdb068f031c6 ("bus/vdev: scan by multi-process channel")

Applied, thanks