From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9F016A054F; Mon, 15 Mar 2021 20:27:43 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 288902427A9; Mon, 15 Mar 2021 20:27:36 +0100 (CET) Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by mails.dpdk.org (Postfix) with ESMTP id 643CE2427A0 for ; Mon, 15 Mar 2021 20:27:34 +0100 (CET) Received: by mail-pf1-f182.google.com with SMTP id 16so7238273pfn.5 for ; Mon, 15 Mar 2021 12:27:34 -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=soWTY76xmjbkpM/j4DzBl2AM5jB0ubvmUxE5avYJmQI=; b=Uxns8pQzsu88aOq3SACSqM1i3vX9Xxt/88BEKm8lbku2wpnyXluzmKHdblHCqr9ZVh PE09oSFG1DsxCOBtHXO1ZJEm2b+jiBlgEnZDjmLIZgxVDt34fi64MS9MzvaD772PylA2 MWhYWe7svQH3er9mpF0jBVvbr8dQdowy3ix7fMundSpbbNOl20P6mFPwqt/XagxEPOuW 1unOKfvHyick+MFPW4TmHbjWdFLZbirI6PwWZlWJPS6dc7XxXFR4iu5jPTi70blnN86N 3XAcyt8jTHRArbfA1skgumu9KzEzP4E3gL2khZVXcv6w48MVbvtvkWtFq/O23jTDo1MO EpJA== 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=soWTY76xmjbkpM/j4DzBl2AM5jB0ubvmUxE5avYJmQI=; b=nngEJ6/v7eC790nzI0MwjRV+Zy3Q5PA8tP1s+WZasZG3N576pOyf9m0jjccKFiHt15 6kzsSKH5kOjawh+uvJQb9QaP1JsphiiKeg0k/kMmqY6zWNa+RAcSvfmUnYz8Unf3VJrr N5qp2b+LaYW4evqtTnzGoVlw5L76OeRSfMPzE5jGgZ74oAO7e6Un/1QCm9w9N+1Geczo GBVb/yVZ3+oIqFNnf9dwZGAj/YU7K96L5puHu3WhDC+VAjwhTuRA3MRUGSBFZvihIVnK ToV7/aTZAOwdWrRBzL3fdxkM5jICUoSEaBCrnBvrwBMbDO/A+1/X+K8tcV9CYZdvL4xJ DjbQ== X-Gm-Message-State: AOAM531pwlrN2vZXY6R1vRON/UKkfPuHn/bMn+6Mw39pcxSmpMWKBGP/ bT/8OkIAad1vwE4eRWxhIrQAtqKfhkGD2w== X-Google-Smtp-Source: ABdhPJwbHa6U4X0DpEAUw7oKhbU+SBFLtJ67OtmOQNSwCBghogz5rjND6jFU0nHNbHSG+N5lMaZAcA== X-Received: by 2002:a62:ce4e:0:b029:1fa:b601:6681 with SMTP id y75-20020a62ce4e0000b02901fab6016681mr11805704pfg.2.1615836453060; Mon, 15 Mar 2021 12:27:33 -0700 (PDT) Received: from hermes.local (76-14-218-44.or.wavecable.com. [76.14.218.44]) by smtp.gmail.com with ESMTPSA id v26sm13729202pff.195.2021.03.15.12.27.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Mar 2021 12:27:32 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , matan@mellanox.com Date: Mon, 15 Mar 2021 12:27:22 -0700 Message-Id: <20210315192722.35490-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315192722.35490-1-stephen@networkplumber.org> References: <20210315192722.35490-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 2/2] net/failsafe: fix primary/secondary mutex X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Set mutex used in failsafe driver to protect when used by both primary and secondary process. Without this fix, the failsafe lock is not really locking when there are multiple secondary processes. Bugzilla ID: 662 Signed-off-by: Stephen Hemminger Fixes: 655fcd68c7d2 ("net/failsafe: fix hotplug races") Cc: matan@mellanox.com --- drivers/net/failsafe/failsafe.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index e3bda0df2bf9..5b7e560dbc08 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -140,6 +140,11 @@ fs_mutex_init(struct fs_priv *priv) ERROR("Cannot initiate mutex attributes - %s", strerror(ret)); return ret; } + /* Allow mutex to protect primary/secondary */ + ret = pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); + if (ret) + ERROR("Cannot set mutex shared - %s", strerror(ret)); + /* Allow mutex relocks for the thread holding the mutex. */ ret = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); if (ret) { -- 2.30.2