Re: [oi-dev] [developer] [Samba] gencache.tdb: device busy

2019-04-21 Thread Rouven WEILER
Well, the only thing I got was that there is the return code EBUSY on all 
mutexes, when I run unpatched and the issue only exists on illumos not linux. 
Using debuggers etc i did not succeed due to my lacking knowledge.

> Am 21.04.2019 um 14:28 schrieb Richard Lowe :
> 
> You could check whether the mutex already looks initialized to us using a 
> debugger or logging statements added to the code.
> 
> If that's the case, we can think again about relaxing the check I added in 
> 9959.
> 
> 
> 
>> On Sun, Apr 21, 2019, 08:20 Rouven WEILER  wrote:
>> Any chance to get to know what happens?
>> 
>>> Am 21.04.2019 um 14:12 schrieb Richard Lowe :
>>> 
>>> It's possible there's a bug.  It's also possible you're getting really 
>>> unlucky and the uninitialized mutex looks valid because the magic is valid.
>>> 
 On Sun, Apr 21, 2019, 06:10 Rouven WEILER  wrote:
 Dear all,
 
 trying to make samba work and getting rid of my error message 
 [2019/04/01 09:51:41.112485,  0] 
 ../../lib/tdb_wrap/tdb_wrap.c:64(tdb_wrap_log)
  tdb(/var/samba/lock/gencache.tdb): tdb_open_ex: tdb_mutex_init failed for 
 /var/samba/lock/gencache.tdb: Device busy
 
 I followed the info of Youzhong. It definitely works. So thankx.
 BUT: The OS (OpenIndiana; state of April,19th) is patched against the 
 illumos issue 9959
 
 So there might be some mechanism (maybe MUTEX_MAGIC) that avoids the 
 initialization of the mutex before init.
 I am really not deep in all that pthread stuff…
 
 Is there the possiblity that there is a bug in the code base of issue 9959?
 
 
 Best regards
 
 Rouven
 
 
> Am 18.04.2019 um 19:20 schrieb Robert Mustacchi :
> 
> On 4/18/19 10:12 , Youzhong Yang wrote:
>> Little bit confused. The page  https://www.openindiana.org/download/ 
>> shows
>> latest ISO is dated 2018.10, but 9959 fix was submitted on 11/26/2018, I
>> guess Hipster doesn't have it.
> 
> The ISO is just the install image. Generally, after using that to
> bootstrap, then folks will update to latest bits via IPS. As a result,
> the ISO isn't updated (and generally doesn't have to be) quite as often.
> 
> Robert
> 
>> On Thu, Apr 18, 2019 at 12:38 PM Rouven WEILER 
>> wrote:
>> 
>>> On my system the issue is solved and the sources are patched 
>>> accordingly.
>>> Thus, the issue seems to be somewhere else.
>>> 
>>> Am 18.04.2019 um 18:27 schrieb Rouven WEILER :
>>> 
>>> concerning openindiana I am using the most recent one. I right now asked
>>> if the issue is solved in the latest version.
>>> 
>>> another interesting thing is that older samba versions do not throw 
>>> EBUSY,
>>> although on the same underlying system.
>>> 
>>> 
>>> 
>>> Am 18.04.2019 um 18:07 schrieb Youzhong Yang :
>>> 
>>> That is interesting. I am curious about how pthread_mutexattr_init ends 
>>> up
>>> returning EBUSY. What verison of Openindiana are you running? is there a
>>> link pointing to the fix that it has for 9959?
>>> 
>>> On Thu, Apr 18, 2019 at 11:53 AM Rouven WEILER 
>>> wrote:
>>> 
 I understand and see that it works, but as written below
 pthread_mutexattr_init throws EBUSY, not pthread_mutex_init.
 
 Also Openindiana seems to include the patch for issue 9959 mentioned. I
 will clarify that to make sure.
 
 I just want to make sure that the patch you suggest aims for the issue
 and is not a workaround.
 
 
 Am 18.04.2019 um 16:09 schrieb Youzhong Yang :
 
 I reproduced the issue on a smartos version which does not have the fix
 for  https://www.illumos.org/issues/9959.
 
 The pthread_mutex_init() at line 590 returns EBUSY:
 ret = pthread_mutex_init(chain, );
 
 https://git.samba.org/?p=samba.git;a=blob;f=lib/tdb/common/mutex.c;h=8a122d5d6a2ec321bce25cf06062acc808f1e126;hb=HEAD#l590
 
 
 Then I applied the following patch to lib/tdb/common/mutex.c:
 
 # git grep -B 1 -n pthread_mutex_init lib/tdb/common/mutex.c
 lib/tdb/common/mutex.c-590- bzero(chain,
 sizeof(pthread_mutex_t));
 lib/tdb/common/mutex.c:591: ret = pthread_mutex_init(chain,
 );
 --
 lib/tdb/common/mutex.c-599- bzero(>allrecord_mutex,
 sizeof(pthread_mutex_t));
 lib/tdb/common/mutex.c:600: ret =
 pthread_mutex_init(>allrecord_mutex, );
 --
 lib/tdb/common/mutex.c-693- bzero(, sizeof(pthread_mutex_t));
 lib/tdb/common/mutex.c:694: ret = pthread_mutex_init(, );
 --
 lib/tdb/common/mutex.c-891- bzero(ptr, sizeof(pthread_mutex_t));
 lib/tdb/common/mutex.c:892: ret = 

Re: [oi-dev] [developer] [Samba] gencache.tdb: device busy

2019-04-21 Thread Richard Lowe
You could check whether the mutex already looks initialized to us using a
debugger or logging statements added to the code.

If that's the case, we can think again about relaxing the check I added in
9959.



On Sun, Apr 21, 2019, 08:20 Rouven WEILER  wrote:

> Any chance to get to know what happens?
>
> Am 21.04.2019 um 14:12 schrieb Richard Lowe :
>
> It's possible there's a bug.  It's also possible you're getting really
> unlucky and the uninitialized mutex looks valid because the magic is valid.
>
> On Sun, Apr 21, 2019, 06:10 Rouven WEILER  wrote:
>
>> Dear all,
>>
>> trying to make samba work and getting rid of my error message
>>
>> [2019/04/01 09:51:41.112485,  0] 
>> ../../lib/tdb_wrap/tdb_wrap.c:64(tdb_wrap_log)
>>  tdb(/var/samba/lock/gencache.tdb): tdb_open_ex: tdb_mutex_init failed for 
>> /var/samba/lock/gencache.tdb: Device busy
>>
>>
>> I followed the info of Youzhong. It definitely works. So thankx.
>> BUT: The OS (OpenIndiana; state of April,19th) is patched against the
>> illumos issue 9959
>>
>> So there might be some mechanism (maybe MUTEX_MAGIC) that avoids the
>> initialization of the mutex before init.
>> I am really not deep in all that pthread stuff…
>>
>> Is there the possiblity that there is a bug in the code base of issue
>> 9959?
>>
>>
>> Best regards
>>
>> Rouven
>>
>>
>> Am 18.04.2019 um 19:20 schrieb Robert Mustacchi :
>>
>> On 4/18/19 10:12 , Youzhong Yang wrote:
>>
>> Little bit confused. The page  https://www.openindiana.org/download/
>> shows
>> latest ISO is dated 2018.10, but 9959 fix was submitted on 11/26/2018, I
>> guess Hipster doesn't have it.
>>
>>
>> The ISO is just the install image. Generally, after using that to
>> bootstrap, then folks will update to latest bits via IPS. As a result,
>> the ISO isn't updated (and generally doesn't have to be) quite as often.
>>
>> Robert
>>
>> On Thu, Apr 18, 2019 at 12:38 PM Rouven WEILER 
>> wrote:
>>
>> On my system the issue is solved and the sources are patched accordingly.
>> Thus, the issue seems to be somewhere else.
>>
>> Am 18.04.2019 um 18:27 schrieb Rouven WEILER :
>>
>> concerning openindiana I am using the most recent one. I right now asked
>> if the issue is solved in the latest version.
>>
>> another interesting thing is that older samba versions do not throw EBUSY,
>> although on the same underlying system.
>>
>>
>>
>> Am 18.04.2019 um 18:07 schrieb Youzhong Yang :
>>
>> That is interesting. I am curious about how pthread_mutexattr_init ends up
>> returning EBUSY. What verison of Openindiana are you running? is there a
>> link pointing to the fix that it has for 9959?
>>
>> On Thu, Apr 18, 2019 at 11:53 AM Rouven WEILER 
>> wrote:
>>
>> I understand and see that it works, but as written below
>> pthread_mutexattr_init throws EBUSY, not pthread_mutex_init.
>>
>> Also Openindiana seems to include the patch for issue 9959 mentioned. I
>> will clarify that to make sure.
>>
>> I just want to make sure that the patch you suggest aims for the issue
>> and is not a workaround.
>>
>>
>> Am 18.04.2019 um 16:09 schrieb Youzhong Yang :
>>
>> I reproduced the issue on a smartos version which does not have the fix
>> for  https://www.illumos.org/issues/9959.
>>
>> The pthread_mutex_init() at line 590 returns EBUSY:
>> ret = pthread_mutex_init(chain, );
>>
>>
>> https://git.samba.org/?p=samba.git;a=blob;f=lib/tdb/common/mutex.c;h=8a122d5d6a2ec321bce25cf06062acc808f1e126;hb=HEAD#l590
>>
>>
>> Then I applied the following patch to lib/tdb/common/mutex.c:
>>
>> # git grep -B 1 -n pthread_mutex_init lib/tdb/common/mutex.c
>> lib/tdb/common/mutex.c-590- bzero(chain,
>> sizeof(pthread_mutex_t));
>> lib/tdb/common/mutex.c:591: ret = pthread_mutex_init(chain,
>> );
>> --
>> lib/tdb/common/mutex.c-599- bzero(>allrecord_mutex,
>> sizeof(pthread_mutex_t));
>> lib/tdb/common/mutex.c:600: ret =
>> pthread_mutex_init(>allrecord_mutex, );
>> --
>> lib/tdb/common/mutex.c-693- bzero(, sizeof(pthread_mutex_t));
>> lib/tdb/common/mutex.c:694: ret = pthread_mutex_init(, );
>> --
>> lib/tdb/common/mutex.c-891- bzero(ptr, sizeof(pthread_mutex_t));
>> lib/tdb/common/mutex.c:892: ret = pthread_mutex_init(ptr, );
>>
>> It works like a charm. Fair enough?
>>
>> So again I recommend either of the following two:
>> - apply 9959 fix to your OS image, or use a newer version which has 9959
>> fix
>> - bzero pthread_mutex_t struct before calling pthread_mutex_init().
>>
>> In my environment I applied bzero patch to all pthread_mutex_init() calls
>> in the entire samba code base, you know, who knows what is going to
>> happen.
>>
>>
>>
>> On Thu, Apr 18, 2019 at 4:29 AM Rouven WEILER 
>> wrote:
>>
>> That sounds reasonable!
>> Could you help me to dtrace that in a feasible way? Up to now I am not
>> used to dtrace. Except knowing what is and that its powerful.
>>
>> Am 18.04.2019 um 09:29 schrieb Jason King :
>>
>> It appears that the robust mutexes are mmapped from the .tdb file.
>> EBUSY means that the 

Re: [oi-dev] [developer] [Samba] gencache.tdb: device busy

2019-04-21 Thread Rouven WEILER
Any chance to get to know what happens?

> Am 21.04.2019 um 14:12 schrieb Richard Lowe :
> 
> It's possible there's a bug.  It's also possible you're getting really 
> unlucky and the uninitialized mutex looks valid because the magic is valid.
> 
>> On Sun, Apr 21, 2019, 06:10 Rouven WEILER  wrote:
>> Dear all,
>> 
>> trying to make samba work and getting rid of my error message 
>> [2019/04/01 09:51:41.112485,  0] 
>> ../../lib/tdb_wrap/tdb_wrap.c:64(tdb_wrap_log)
>>  tdb(/var/samba/lock/gencache.tdb): tdb_open_ex: tdb_mutex_init failed for 
>> /var/samba/lock/gencache.tdb: Device busy
>> 
>> I followed the info of Youzhong. It definitely works. So thankx.
>> BUT: The OS (OpenIndiana; state of April,19th) is patched against the 
>> illumos issue 9959
>> 
>> So there might be some mechanism (maybe MUTEX_MAGIC) that avoids the 
>> initialization of the mutex before init.
>> I am really not deep in all that pthread stuff…
>> 
>> Is there the possiblity that there is a bug in the code base of issue 9959?
>> 
>> 
>> Best regards
>> 
>> Rouven
>> 
>> 
>>> Am 18.04.2019 um 19:20 schrieb Robert Mustacchi :
>>> 
>>> On 4/18/19 10:12 , Youzhong Yang wrote:
 Little bit confused. The page  https://www.openindiana.org/download/ shows
 latest ISO is dated 2018.10, but 9959 fix was submitted on 11/26/2018, I
 guess Hipster doesn't have it.
>>> 
>>> The ISO is just the install image. Generally, after using that to
>>> bootstrap, then folks will update to latest bits via IPS. As a result,
>>> the ISO isn't updated (and generally doesn't have to be) quite as often.
>>> 
>>> Robert
>>> 
 On Thu, Apr 18, 2019 at 12:38 PM Rouven WEILER 
 wrote:
 
> On my system the issue is solved and the sources are patched accordingly.
> Thus, the issue seems to be somewhere else.
> 
> Am 18.04.2019 um 18:27 schrieb Rouven WEILER :
> 
> concerning openindiana I am using the most recent one. I right now asked
> if the issue is solved in the latest version.
> 
> another interesting thing is that older samba versions do not throw EBUSY,
> although on the same underlying system.
> 
> 
> 
> Am 18.04.2019 um 18:07 schrieb Youzhong Yang :
> 
> That is interesting. I am curious about how pthread_mutexattr_init ends up
> returning EBUSY. What verison of Openindiana are you running? is there a
> link pointing to the fix that it has for 9959?
> 
> On Thu, Apr 18, 2019 at 11:53 AM Rouven WEILER 
> wrote:
> 
>> I understand and see that it works, but as written below
>> pthread_mutexattr_init throws EBUSY, not pthread_mutex_init.
>> 
>> Also Openindiana seems to include the patch for issue 9959 mentioned. I
>> will clarify that to make sure.
>> 
>> I just want to make sure that the patch you suggest aims for the issue
>> and is not a workaround.
>> 
>> 
>> Am 18.04.2019 um 16:09 schrieb Youzhong Yang :
>> 
>> I reproduced the issue on a smartos version which does not have the fix
>> for  https://www.illumos.org/issues/9959.
>> 
>> The pthread_mutex_init() at line 590 returns EBUSY:
>> ret = pthread_mutex_init(chain, );
>> 
>> https://git.samba.org/?p=samba.git;a=blob;f=lib/tdb/common/mutex.c;h=8a122d5d6a2ec321bce25cf06062acc808f1e126;hb=HEAD#l590
>> 
>> 
>> Then I applied the following patch to lib/tdb/common/mutex.c:
>> 
>> # git grep -B 1 -n pthread_mutex_init lib/tdb/common/mutex.c
>> lib/tdb/common/mutex.c-590- bzero(chain,
>> sizeof(pthread_mutex_t));
>> lib/tdb/common/mutex.c:591: ret = pthread_mutex_init(chain,
>> );
>> --
>> lib/tdb/common/mutex.c-599- bzero(>allrecord_mutex,
>> sizeof(pthread_mutex_t));
>> lib/tdb/common/mutex.c:600: ret =
>> pthread_mutex_init(>allrecord_mutex, );
>> --
>> lib/tdb/common/mutex.c-693- bzero(, sizeof(pthread_mutex_t));
>> lib/tdb/common/mutex.c:694: ret = pthread_mutex_init(, );
>> --
>> lib/tdb/common/mutex.c-891- bzero(ptr, sizeof(pthread_mutex_t));
>> lib/tdb/common/mutex.c:892: ret = pthread_mutex_init(ptr, );
>> 
>> It works like a charm. Fair enough?
>> 
>> So again I recommend either of the following two:
>> - apply 9959 fix to your OS image, or use a newer version which has 9959
>> fix
>> - bzero pthread_mutex_t struct before calling pthread_mutex_init().
>> 
>> In my environment I applied bzero patch to all pthread_mutex_init() calls
>> in the entire samba code base, you know, who knows what is going to 
>> happen.
>> 
>> 
>> 
>> On Thu, Apr 18, 2019 at 4:29 AM Rouven WEILER 
>> wrote:
>> 
>>> That sounds reasonable!
>>> Could you help me to dtrace that in a feasible way? Up to now I am not
>>> used to dtrace. Except knowing what is and that its powerful.
>>> 
>>> Am 18.04.2019 um 09:29 schrieb Jason King 

Re: [oi-dev] [developer] [Samba] gencache.tdb: device busy

2019-04-21 Thread Richard Lowe
It's possible there's a bug.  It's also possible you're getting really
unlucky and the uninitialized mutex looks valid because the magic is valid.

On Sun, Apr 21, 2019, 06:10 Rouven WEILER  wrote:

> Dear all,
>
> trying to make samba work and getting rid of my error message
>
> [2019/04/01 09:51:41.112485,  0] 
> ../../lib/tdb_wrap/tdb_wrap.c:64(tdb_wrap_log)
>  tdb(/var/samba/lock/gencache.tdb): tdb_open_ex: tdb_mutex_init failed for 
> /var/samba/lock/gencache.tdb: Device busy
>
>
> I followed the info of Youzhong. It definitely works. So thankx.
> BUT: The OS (OpenIndiana; state of April,19th) is patched against the
> illumos issue 9959
>
> So there might be some mechanism (maybe MUTEX_MAGIC) that avoids the
> initialization of the mutex before init.
> I am really not deep in all that pthread stuff…
>
> Is there the possiblity that there is a bug in the code base of issue 9959?
>
>
> Best regards
>
> Rouven
>
>
> Am 18.04.2019 um 19:20 schrieb Robert Mustacchi :
>
> On 4/18/19 10:12 , Youzhong Yang wrote:
>
> Little bit confused. The page  https://www.openindiana.org/download/ shows
> latest ISO is dated 2018.10, but 9959 fix was submitted on 11/26/2018, I
> guess Hipster doesn't have it.
>
>
> The ISO is just the install image. Generally, after using that to
> bootstrap, then folks will update to latest bits via IPS. As a result,
> the ISO isn't updated (and generally doesn't have to be) quite as often.
>
> Robert
>
> On Thu, Apr 18, 2019 at 12:38 PM Rouven WEILER 
> wrote:
>
> On my system the issue is solved and the sources are patched accordingly.
> Thus, the issue seems to be somewhere else.
>
> Am 18.04.2019 um 18:27 schrieb Rouven WEILER :
>
> concerning openindiana I am using the most recent one. I right now asked
> if the issue is solved in the latest version.
>
> another interesting thing is that older samba versions do not throw EBUSY,
> although on the same underlying system.
>
>
>
> Am 18.04.2019 um 18:07 schrieb Youzhong Yang :
>
> That is interesting. I am curious about how pthread_mutexattr_init ends up
> returning EBUSY. What verison of Openindiana are you running? is there a
> link pointing to the fix that it has for 9959?
>
> On Thu, Apr 18, 2019 at 11:53 AM Rouven WEILER 
> wrote:
>
> I understand and see that it works, but as written below
> pthread_mutexattr_init throws EBUSY, not pthread_mutex_init.
>
> Also Openindiana seems to include the patch for issue 9959 mentioned. I
> will clarify that to make sure.
>
> I just want to make sure that the patch you suggest aims for the issue
> and is not a workaround.
>
>
> Am 18.04.2019 um 16:09 schrieb Youzhong Yang :
>
> I reproduced the issue on a smartos version which does not have the fix
> for  https://www.illumos.org/issues/9959.
>
> The pthread_mutex_init() at line 590 returns EBUSY:
> ret = pthread_mutex_init(chain, );
>
>
> https://git.samba.org/?p=samba.git;a=blob;f=lib/tdb/common/mutex.c;h=8a122d5d6a2ec321bce25cf06062acc808f1e126;hb=HEAD#l590
>
>
> Then I applied the following patch to lib/tdb/common/mutex.c:
>
> # git grep -B 1 -n pthread_mutex_init lib/tdb/common/mutex.c
> lib/tdb/common/mutex.c-590- bzero(chain,
> sizeof(pthread_mutex_t));
> lib/tdb/common/mutex.c:591: ret = pthread_mutex_init(chain,
> );
> --
> lib/tdb/common/mutex.c-599- bzero(>allrecord_mutex,
> sizeof(pthread_mutex_t));
> lib/tdb/common/mutex.c:600: ret =
> pthread_mutex_init(>allrecord_mutex, );
> --
> lib/tdb/common/mutex.c-693- bzero(, sizeof(pthread_mutex_t));
> lib/tdb/common/mutex.c:694: ret = pthread_mutex_init(, );
> --
> lib/tdb/common/mutex.c-891- bzero(ptr, sizeof(pthread_mutex_t));
> lib/tdb/common/mutex.c:892: ret = pthread_mutex_init(ptr, );
>
> It works like a charm. Fair enough?
>
> So again I recommend either of the following two:
> - apply 9959 fix to your OS image, or use a newer version which has 9959
> fix
> - bzero pthread_mutex_t struct before calling pthread_mutex_init().
>
> In my environment I applied bzero patch to all pthread_mutex_init() calls
> in the entire samba code base, you know, who knows what is going to happen.
>
>
>
> On Thu, Apr 18, 2019 at 4:29 AM Rouven WEILER 
> wrote:
>
> That sounds reasonable!
> Could you help me to dtrace that in a feasible way? Up to now I am not
> used to dtrace. Except knowing what is and that its powerful.
>
> Am 18.04.2019 um 09:29 schrieb Jason King :
>
> It appears that the robust mutexes are mmapped from the .tdb file.
> EBUSY means that the mutex has already been intialized.  It also appears
> that if the TDB_CLEAR_IF_FIRST flag is _not_ set when opening the tdb, it
> will try to initialize the mutexes.  I’m wondering if the tdb file gets
> created, the memory image of the initialized mutexes is getting saved, then
> when it’s opened again, if that flag is not set, it tries to re-initialize
> the mutexes and fails (because they are already constructed) legitimately
> returning EBUSY.  If the samba code is in fact trying to 

Re: [oi-dev] [developer] [Samba] gencache.tdb: device busy

2019-04-21 Thread Rouven WEILER
Dear all,

trying to make samba work and getting rid of my error message 
[2019/04/01 09:51:41.112485,  0] ../../lib/tdb_wrap/tdb_wrap.c:64(tdb_wrap_log)
 tdb(/var/samba/lock/gencache.tdb): tdb_open_ex: tdb_mutex_init failed for 
/var/samba/lock/gencache.tdb: Device busy

I followed the info of Youzhong. It definitely works. So thankx.
BUT: The OS (OpenIndiana; state of April,19th) is patched against the illumos 
issue 9959

So there might be some mechanism (maybe MUTEX_MAGIC) that avoids the 
initialization of the mutex before init.
I am really not deep in all that pthread stuff…

Is there the possiblity that there is a bug in the code base of issue 9959?


Best regards

Rouven


> Am 18.04.2019 um 19:20 schrieb Robert Mustacchi :
> 
> On 4/18/19 10:12 , Youzhong Yang wrote:
>> Little bit confused. The page  https://www.openindiana.org/download/ shows
>> latest ISO is dated 2018.10, but 9959 fix was submitted on 11/26/2018, I
>> guess Hipster doesn't have it.
> 
> The ISO is just the install image. Generally, after using that to
> bootstrap, then folks will update to latest bits via IPS. As a result,
> the ISO isn't updated (and generally doesn't have to be) quite as often.
> 
> Robert
> 
>> On Thu, Apr 18, 2019 at 12:38 PM Rouven WEILER 
>> wrote:
>> 
>>> On my system the issue is solved and the sources are patched accordingly.
>>> Thus, the issue seems to be somewhere else.
>>> 
>>> Am 18.04.2019 um 18:27 schrieb Rouven WEILER :
>>> 
>>> concerning openindiana I am using the most recent one. I right now asked
>>> if the issue is solved in the latest version.
>>> 
>>> another interesting thing is that older samba versions do not throw EBUSY,
>>> although on the same underlying system.
>>> 
>>> 
>>> 
>>> Am 18.04.2019 um 18:07 schrieb Youzhong Yang :
>>> 
>>> That is interesting. I am curious about how pthread_mutexattr_init ends up
>>> returning EBUSY. What verison of Openindiana are you running? is there a
>>> link pointing to the fix that it has for 9959?
>>> 
>>> On Thu, Apr 18, 2019 at 11:53 AM Rouven WEILER 
>>> wrote:
>>> 
 I understand and see that it works, but as written below
 pthread_mutexattr_init throws EBUSY, not pthread_mutex_init.
 
 Also Openindiana seems to include the patch for issue 9959 mentioned. I
 will clarify that to make sure.
 
 I just want to make sure that the patch you suggest aims for the issue
 and is not a workaround.
 
 
 Am 18.04.2019 um 16:09 schrieb Youzhong Yang :
 
 I reproduced the issue on a smartos version which does not have the fix
 for  https://www.illumos.org/issues/9959.
 
 The pthread_mutex_init() at line 590 returns EBUSY:
 ret = pthread_mutex_init(chain, );
 
 https://git.samba.org/?p=samba.git;a=blob;f=lib/tdb/common/mutex.c;h=8a122d5d6a2ec321bce25cf06062acc808f1e126;hb=HEAD#l590
 
 
 Then I applied the following patch to lib/tdb/common/mutex.c:
 
 # git grep -B 1 -n pthread_mutex_init lib/tdb/common/mutex.c
 lib/tdb/common/mutex.c-590- bzero(chain,
 sizeof(pthread_mutex_t));
 lib/tdb/common/mutex.c:591: ret = pthread_mutex_init(chain,
 );
 --
 lib/tdb/common/mutex.c-599- bzero(>allrecord_mutex,
 sizeof(pthread_mutex_t));
 lib/tdb/common/mutex.c:600: ret =
 pthread_mutex_init(>allrecord_mutex, );
 --
 lib/tdb/common/mutex.c-693- bzero(, sizeof(pthread_mutex_t));
 lib/tdb/common/mutex.c:694: ret = pthread_mutex_init(, );
 --
 lib/tdb/common/mutex.c-891- bzero(ptr, sizeof(pthread_mutex_t));
 lib/tdb/common/mutex.c:892: ret = pthread_mutex_init(ptr, );
 
 It works like a charm. Fair enough?
 
 So again I recommend either of the following two:
 - apply 9959 fix to your OS image, or use a newer version which has 9959
 fix
 - bzero pthread_mutex_t struct before calling pthread_mutex_init().
 
 In my environment I applied bzero patch to all pthread_mutex_init() calls
 in the entire samba code base, you know, who knows what is going to happen.
 
 
 
 On Thu, Apr 18, 2019 at 4:29 AM Rouven WEILER 
 wrote:
 
> That sounds reasonable!
> Could you help me to dtrace that in a feasible way? Up to now I am not
> used to dtrace. Except knowing what is and that its powerful.
> 
> Am 18.04.2019 um 09:29 schrieb Jason King :
> 
> It appears that the robust mutexes are mmapped from the .tdb file.
> EBUSY means that the mutex has already been intialized.  It also appears
> that if the TDB_CLEAR_IF_FIRST flag is _not_ set when opening the tdb, it
> will try to initialize the mutexes.  I’m wondering if the tdb file gets
> created, the memory image of the initialized mutexes is getting saved, 
> then
> when it’s opened again, if that flag is not set, it tries to re-initialize
> the mutexes and fails (because they are already constructed) legitimately
>