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 6111CA034F; Tue, 8 Jun 2021 10:00:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E0BA4410E7; Tue, 8 Jun 2021 10:00:38 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 2AC7D4013F for ; Tue, 8 Jun 2021 10:00:38 +0200 (CEST) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 91B137F53D; Tue, 8 Jun 2021 11:00:37 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 91B137F53D DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1623139237; bh=9uXruQNH0WRbMwikHzXywVOfffSRoWZu0o2XgcjrnF8=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=Du84p5SjNfKIeam6ro4kHmZi/KJhxy12lt3xPcwTPjSgs/y7Jq943SysmJ2I5mbUZ aJrcMUpLvj+Ab57xwQKgLt1vugC5j3hEFSO4rN78lD4waIwETm5GTVYtM/I+Pqe/sG W5Vf66LS0/0FIGcdHVEps4ic4z6EKAFfALCuw+Pk= To: Thomas Monjalon , Stephen Hemminger Cc: dev@dpdk.org, matan@mellanox.com, Gaetan Rivet References: <20210315192722.35490-1-stephen@networkplumber.org> <20210315192722.35490-3-stephen@networkplumber.org> <6747934.v7ilQdk43l@thomas> From: Andrew Rybchenko Organization: OKTET Labs Message-ID: Date: Tue, 8 Jun 2021 11:00:37 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <6747934.v7ilQdk43l@thomas> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 4/19/21 8:08 PM, Thomas Monjalon wrote: > 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 >> 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 > >> --- >> --- 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? +1 I think it would be safer to return an error here.