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 6E260A0C40; Tue, 8 Jun 2021 17:55:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E02C540689; Tue, 8 Jun 2021 17:55:19 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 299D64067A for ; Tue, 8 Jun 2021 17:55:18 +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 779FD7F664; Tue, 8 Jun 2021 18:55:17 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 779FD7F664 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1623167717; bh=N4W2CiSOCV5rCwqBJz79qFw/gDTtVQxYzHwDr76I5mo=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=u6ScfzOC3YjICREMJIBL9DNZQBQ+Cjv5ERoCPHAP2097hUR0Iu0GxjpRcZNj16E+y ruUuipDk1n87WEWdhm64hmlUBMYtqsuqFMyDY061ZqSyIMhed27XiG490z6dzJeHgX M8ipwtcMVsrFzEnEsmXoZIQtOwA7GyJF7A1Ep7IM= To: Stephen Hemminger Cc: Thomas Monjalon , dev@dpdk.org, matan@mellanox.com, Gaetan Rivet References: <20210315192722.35490-1-stephen@networkplumber.org> <20210315192722.35490-3-stephen@networkplumber.org> <6747934.v7ilQdk43l@thomas> <20210608084210.73d05f60@hermes.local> From: Andrew Rybchenko Organization: OKTET Labs Message-ID: Date: Tue, 8 Jun 2021 18:55:17 +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: <20210608084210.73d05f60@hermes.local> 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 6/8/21 6:42 PM, Stephen Hemminger wrote: > On Tue, 8 Jun 2021 11:00:37 +0300 > Andrew Rybchenko wrote: > >> 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. > > Ok but it never happens. > May I ask why? 'man pthread_mutexattr_setpshared' says that it is possible.