From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 33C6EA04B0 for ; Sat, 24 Oct 2020 02:43:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EC10F6CAA; Sat, 24 Oct 2020 02:43:42 +0200 (CEST) Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by dpdk.org (Postfix) with ESMTP id DA6486CAA for ; Sat, 24 Oct 2020 02:43:41 +0200 (CEST) Received: by mail-pl1-f193.google.com with SMTP id 1so1906810ple.2 for ; Fri, 23 Oct 2020 17:43:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GwIRAmh8l2MaVySCGvV3KTnZC8uwaC5+AEFUOWCnSHo=; b=dflZ/Ugu9kEBgqO+ywJOMHyvK3ISC2m01FFo7OfXHWlqQ7UpGiXuVm9/sMrhWh6Gsh aQ4GXMseRoAvfGluqw6lwLuR4aLJat+vAiMCy6l57w7W+1lDLtvTlsbWJQ5qdOmV5i6I aoC69nMIU8TH8ZC7ipkr25mcro3b4d4JOmJQNBpgVLuJBof6mtkRVR+oa/bpS0SiQRQY /61sA/X1vZQ6t0WRbTSWZQ9Dwftl/RIXrfbJkZATyAmCdDjITTzkHEAWhS18TPy/f2dW /nI+7l3F+MwWixSUFD0ytlJVz7JGxlnKLXoh5FwsCJXTHK+hvW6uqkRgDvOUGwnSoewh XOBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GwIRAmh8l2MaVySCGvV3KTnZC8uwaC5+AEFUOWCnSHo=; b=EKk3N3ZtvSwpAShY7BqOMTjf9C5cw7oFURQAJF1dD07/cpkcBc+ZimGKHh2+WURNWp E7eDwdc9yusqURs8BPt/9ci1QrcrrCw9pIu6dVJE3ElH7/XlVFC2P/cnYy9y/XElK1D4 8HIuiWck85PzTR7GEIHFSlabuZnOLZpvnmwRElHoNVk0JBi3BRRnLBSrIjY3QGFFaFSr 2bVbwPqNDKQlKEfD8bLOo8FhIQ5o94IYCy/hJl6ned9WsaBBgqOzar0uoQgCxyjX8/cp UyaIaVyT2WKjSE5ctGVGEl6/53t7B80XA1Qb4afTtrmTQqL/IpFK/Ofy7PGmREnLYxo1 q83A== X-Gm-Message-State: AOAM531L8XD5beYb39CHLCDQsOSzScE3Ch9ayJ8FGVPoKJt7b8HQqaf3 XfxNqHfcwYUzk43D0jjpcTps3ZeSC91IVByN X-Google-Smtp-Source: ABdhPJxbft/26+/9s35X4BtROVCeTcKaT5+QT7J1TE50Qpgm1E+LlD7bDO/8zsSzf/LCevjzMbP8EA== X-Received: by 2002:a17:902:cb05:b029:d5:e8de:fb62 with SMTP id c5-20020a170902cb05b02900d5e8defb62mr1499513ply.62.1603500219927; Fri, 23 Oct 2020 17:43:39 -0700 (PDT) Received: from hermes.corp.microsoft.com (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id u7sm3386224pfn.37.2020.10.23.17.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Oct 2020 17:43:38 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: stable@dpdk.org, Stephen Hemminger , olivier.matz@6wind.com Date: Fri, 23 Oct 2020 17:43:31 -0700 Message-Id: <20201024004331.25043-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201015172019.3181-1-stephen@networkplumber.org> References: <20201015172019.3181-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH v3] mbuf: fix dynamic flags lookup from secondary process X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" The dynamic flag management is broken if rte_mbuf_dynflag_lookup() is done in a secondary process because the local pointer to the memzone is not ever initialized. Fix it by using the same checks as dynfield_register(). I.e if shared memory zone has not been looked up already, then discover it. Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags") Cc: olivier.matz@6wind.com Signed-off-by: Stephen Hemminger --- v3 - change title, fix one extra whitespace lib/librte_mbuf/rte_mbuf_dyn.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf_dyn.c b/lib/librte_mbuf/rte_mbuf_dyn.c index 538a43f6959f..554ec5a1ca4f 100644 --- a/lib/librte_mbuf/rte_mbuf_dyn.c +++ b/lib/librte_mbuf/rte_mbuf_dyn.c @@ -185,13 +185,11 @@ rte_mbuf_dynfield_lookup(const char *name, struct rte_mbuf_dynfield *params) { struct mbuf_dynfield_elt *mbuf_dynfield; - if (shm == NULL) { - rte_errno = ENOENT; - return -1; - } - rte_mcfg_tailq_read_lock(); - mbuf_dynfield = __mbuf_dynfield_lookup(name); + if (shm == NULL && init_shared_mem() < 0) + mbuf_dynfield = NULL; + else + mbuf_dynfield = __mbuf_dynfield_lookup(name); rte_mcfg_tailq_read_unlock(); if (mbuf_dynfield == NULL) { @@ -384,13 +382,11 @@ rte_mbuf_dynflag_lookup(const char *name, { struct mbuf_dynflag_elt *mbuf_dynflag; - if (shm == NULL) { - rte_errno = ENOENT; - return -1; - } - rte_mcfg_tailq_read_lock(); - mbuf_dynflag = __mbuf_dynflag_lookup(name); + if (shm == NULL && init_shared_mem() < 0) + mbuf_dynflag = NULL; + else + mbuf_dynflag = __mbuf_dynflag_lookup(name); rte_mcfg_tailq_read_unlock(); if (mbuf_dynflag == NULL) { -- 2.27.0