Date: Thu, 24 Sep 2009 08:35:18 +0000 (UTC) From: Attilio Rao <attilio@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r197452 - in stable/8/lib/libthr: . thread Message-ID: <200909240835.n8O8ZIeI090122@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: attilio Date: Thu Sep 24 08:35:17 2009 New Revision: 197452 URL: http://svn.freebsd.org/changeset/base/197452 Log: MFC r197445: Let fall down in the hard path (thus handling shared waiters wakeup correctly) for the shared waiters also in the rwlock held in shared mode as well, fixing possible deadlocks. Please note that this is a special condition as we want this fix in before RC2 as we assume it is critical and so it has been handled as an instant-merge. For the STABLE_7 branch, 1 week before the MFC is assumed. Approved by: re (kib) Modified: stable/8/lib/libthr/ (props changed) stable/8/lib/libthr/thread/thr_umtx.h Modified: stable/8/lib/libthr/thread/thr_umtx.h ============================================================================== --- stable/8/lib/libthr/thread/thr_umtx.h Thu Sep 24 08:16:12 2009 (r197451) +++ stable/8/lib/libthr/thread/thr_umtx.h Thu Sep 24 08:35:17 2009 (r197452) @@ -171,8 +171,11 @@ _thr_rwlock_unlock(struct urwlock *rwloc for (;;) { if (__predict_false(URWLOCK_READER_COUNT(state) == 0)) return (EPERM); - if (!((state & URWLOCK_WRITE_WAITERS) && URWLOCK_READER_COUNT(state) == 1)) { - if (atomic_cmpset_rel_32(&rwlock->rw_state, state, state-1)) + if (!((state & (URWLOCK_WRITE_WAITERS | + URWLOCK_READ_WAITERS)) && + URWLOCK_READER_COUNT(state) == 1)) { + if (atomic_cmpset_rel_32(&rwlock->rw_state, + state, state-1)) return (0); state = rwlock->rw_state; } else {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909240835.n8O8ZIeI090122>