Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Jun 2016 00:33:38 +0200
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        Daniel Eischen <deischen@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r302194 - head/lib/libthr/thread
Message-ID:  <20160625223338.GA22802@stack.nl>
In-Reply-To: <20160625172956.GE38613@kib.kiev.ua>
References:  <201606251130.u5PBUeGC001988@repo.freebsd.org> <20160625171440.GA19698@stack.nl> <20160625172956.GE38613@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jun 25, 2016 at 08:29:56PM +0300, Konstantin Belousov wrote:
> I already asked re for approval of the reversal and got it.  But I am still
> hesitating doing the revert vs. returning EDEADLK for error-checking
> mutexes.

> My initial mistake was reading the statement about PTHREAD_MUTEX_ERRORCHECK
> returning EDEADLK as the requirement for both functions.  It was induced
> by reading the following code in samba:
> https://github.com/samba-team/samba/blob/master/lib/tdb/common/mutex.c#L928
> I did extracted this into stand-alone test and checked that glibc does
> return EDEADLK in this case.  BTW, if somebody has Solaris machine available
> to test this, I would be grateful.  Code is available at
> https://www.kib.kiev.ua/kib/pshared/pthread_samba.c

> I.e., plain revert would disable the only known to me consumer of the
> robust mutexes. The patch which I mailed last time, returns EDEADLK for
> trylock on ERRORCHECKed mutexes only. And I am tending toward glibc
> compatibility there, over the literal POSIX compliance, but I want to
> see the confirmation from the Klimenko' test first.

To be bug-compatible with glibc, you'd need to return the wrong
[EDEADLK] error for robust errorcheck mutexes only. Robust
non-errorcheck and non-robust errorcheck mutexes return the correct
[EBUSY]. I have not checked PI and PP mutexes which probably use a
different code path.

I'm not sure whether we should copy glibc's bug, but if we do it must be
documented in the man page. I'm not happy with it because the bug may
break applications written to the standard; at least, Samba developers
should be contacted first.

-- 
Jilles Tjoelker



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160625223338.GA22802>