rte_eal_init() is documented to return -1 with rte_errno set.
rte_config_init() returns -1 without setting it, so a second primary
process fails the config lock and the caller observes rte_errno 0.

Set EAGAIN at that failure. It is the code returned when the lock is
held, and rte_eal_init() already documents it as a resource that can
be retried. The same assignment covers the other config init failures,
which matches the one code used for each later init stage.

Bugzilla ID: 2156
Fixes: 4e8854ae89fa ("eal: do not panic on shared memory init")
Cc: [email protected]

Signed-off-by: Cheryl Bansal <[email protected]>
---
 lib/eal/freebsd/eal.c | 1 +
 lib/eal/linux/eal.c   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index faf5f0e911..5383639e10 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -498,6 +498,7 @@ rte_eal_init(int argc, char **argv)
 
        if (rte_config_init() < 0) {
                rte_eal_init_alert("Cannot init config");
+               rte_errno = EAGAIN;
                goto err_out;
        }
 
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index 278504237d..03ccca2424 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -649,6 +649,7 @@ rte_eal_init(int argc, char **argv)
 
        if (rte_config_init() < 0) {
                rte_eal_init_alert("Cannot init config");
+               rte_errno = EAGAIN;
                goto err_out;
        }
 
-- 
2.43.0

Reply via email to