From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 99337A0524;
	Mon, 19 Apr 2021 19:08:06 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 73C44413B0;
	Mon, 19 Apr 2021 19:08:06 +0200 (CEST)
Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com
 [66.111.4.25]) by mails.dpdk.org (Postfix) with ESMTP id D8EC141390
 for <dev@dpdk.org>; Mon, 19 Apr 2021 19:08:04 +0200 (CEST)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
 by mailout.nyi.internal (Postfix) with ESMTP id 27B6C5C0176;
 Mon, 19 Apr 2021 13:08:04 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute1.internal (MEProxy); Mon, 19 Apr 2021 13:08:04 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding:content-type; s=fm1; bh=
 r5O40vhakdKtl8fHz8dFECSus/zRR8tveXYY0P+UqSA=; b=u+5DtA0HhFQIWitc
 UI9vDCEiroQibepnMC4mmqusL1URAWlg4C1x8n6cLVv0Hr9k+O9YC0sv87g6SyQl
 i47+zU6ciowAXEICvHIRYuJALwfoNPzTswlRcAm6k6dP2NoQidtMy1i2LNHOek0u
 b1PT5FL9QTf8nR9e25N82K+ZA96ve078Rx/NVjyhEReAathGO5e8jvXIDI/Z+QWl
 QxqvyErZq7fyF3H08vGJRXGNoXEmQXjTf0G6w/5QJmBEwhQEFHG+Nf4vq3/KJTVm
 ihvMg7i7EQ0UZl3kyH9jbnqQtPi+n5C+iGRF/psxZYPeuln8fmrZVOy+HmeE1pqO
 d5VEkw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :date:from:in-reply-to:message-id:mime-version:references
 :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender
 :x-sasl-enc; s=fm2; bh=r5O40vhakdKtl8fHz8dFECSus/zRR8tveXYY0P+Uq
 SA=; b=CjdMrbMMnYhMuKlHRLVE51iXZX5iiPdRQGN179h8BEGMUS5jyq/bVcro8
 A6NQVLEhFdkXgScpcyW6kQDw/T3GkPf2q2Cde5Gz/NU9wCYF1WxBWPlia488boJQ
 5V5njggeIbIC7pJuKyIeMaYXqjiwsVh6tgfdKjHVY/XY0x/VpgYmtJFRODMuOso6
 t00+D69I8PQ0aOx1mZgRuWK1z7WlwZGu9ML4rh6kIADBlhGegtsOoI2Dc2CcePrc
 2PB0exXpId817UWj4UU26jimgz3loiByiL6m+ugHzHqeBwGYyUizaN1HQ8geGd/z
 xHYfMN2K73u1ZTlFD1REzXxoQM0gQ==
X-ME-Sender: <xms:87h9YIk-1EXFVgcAxgbsKiSYfq30qgnSl-RNjkVGB0GwOjq9CLAq0w>
 <xme:87h9YE9z7xRVf5SQceB056fyVwy95pYcVYW3HtrclYqegqbfDvPd9MOOqUdmJZGqY
 mS42bp1GczPw4uRag>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddtgedguddutdcutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh
 necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd
 enucfjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhm
 rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc
 ggtffrrghtthgvrhhnpedugefgvdefudfftdefgeelgffhueekgfffhfeujedtteeutdej
 ueeiiedvffegheenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh
 fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr
 lhhonhdrnhgvth
X-ME-Proxy: <xmx:87h9YFpsXd5un3PkYG-moniY5UgkA-ir-x_Tz9obh1dCt2eiz6dm5g>
 <xmx:87h9YFlGUeLA_r4f8XZ2tcYAaXPoMQyb0Mv8LGeY5b-972X8mCtaDg>
 <xmx:87h9YEgrTGGoU_oNgJpuvzNygqG8TTYoOQfC1Uzz27acH_PuFhlMhg>
 <xmx:9Lh9YEpxwYkDDKf5SliTq80ctEHORHEDXTDU0u3o24DVMRXRmgB9KQ>
Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id 51B4E240066;
 Mon, 19 Apr 2021 13:08:03 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org, matan@mellanox.com, Gaetan Rivet <grive@u256.net>
Date: Mon, 19 Apr 2021 19:08:00 +0200
Message-ID: <6747934.v7ilQdk43l@thomas>
In-Reply-To: <20210315192722.35490-3-stephen@networkplumber.org>
References: <20210315192722.35490-1-stephen@networkplumber.org>
 <20210315192722.35490-3-stephen@networkplumber.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Subject: Re: [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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

About the title, better to speak about multi-process,
it is less confusing than primary/secondary.

15/03/2021 20:27, Stephen Hemminger:
> 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 <stephen@networkplumber.org>
> Fixes: 655fcd68c7d2 ("net/failsafe: fix hotplug races")
> Cc: matan@mellanox.com

The correct order for above lines is:

Bugzilla ID: 662
Fixes: 655fcd68c7d2 ("net/failsafe: fix hotplug races")

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

> ---
> --- 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));

Why not returning an error here?