[dpdk-dev] [PATCH 2/2] net/failsafe: fix primary/secondary mutex
Andrew Rybchenko
andrew.rybchenko at oktetlabs.ru
Tue Jun 8 17:55:17 CEST 2021
On 6/8/21 6:42 PM, Stephen Hemminger wrote:
> On Tue, 8 Jun 2021 11:00:37 +0300
> Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru> 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 <stephen at networkplumber.org>
>>>> Fixes: 655fcd68c7d2 ("net/failsafe: fix hotplug races")
>>>> Cc: matan at 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 at 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?
>>
>> +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.
More information about the dev
mailing list