Date: Thu, 25 Aug 2016 19:15:02 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r304812 - head/sys/kern Message-ID: <201608251915.u7PJF2s5015399@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Thu Aug 25 19:15:02 2016 New Revision: 304812 URL: https://svnweb.freebsd.org/changeset/base/304812 Log: In both do_rw_wrlock() and do_rw_rdlock() after r304808, do not obliterate possible error from sleep with errors from umtxq_check_susp(), when looping to clear URWLOCK_{READ,WRITE}_WAITERS. Noted and reviewed by: vangyzen Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Thu Aug 25 17:30:00 2016 (r304811) +++ head/sys/kern/kern_umtx.c Thu Aug 25 19:15:02 2016 (r304812) @@ -2609,7 +2609,7 @@ do_rw_rdlock(struct thread *td, struct u uint32_t flags, wrflags; int32_t state, oldstate; int32_t blocked_readers; - int error, rv; + int error, error1, rv; uq = td->td_umtxq; error = fueword32(&rwlock->rw_flags, &flags); @@ -2758,9 +2758,12 @@ sleep: if (oldstate == state) break; state = oldstate; - error = umtxq_check_susp(td); - if (error != 0) + error1 = umtxq_check_susp(td); + if (error1 != 0) { + if (error == 0) + error = error1; break; + } } } @@ -2783,7 +2786,7 @@ do_rw_wrlock(struct thread *td, struct u int32_t state, oldstate; int32_t blocked_writers; int32_t blocked_readers; - int error, rv; + int error, error1, rv; uq = td->td_umtxq; error = fueword32(&rwlock->rw_flags, &flags); @@ -2929,14 +2932,17 @@ sleep: if (oldstate == state) break; state = oldstate; - error = umtxq_check_susp(td); + error1 = umtxq_check_susp(td); /* * We are leaving the URWLOCK_WRITE_WAITERS * behind, but this should not harm the * correctness. */ - if (error != 0) + if (error1 != 0) { + if (error == 0) + error = error1; break; + } } rv = fueword32(&rwlock->rw_blocked_readers, &blocked_readers);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608251915.u7PJF2s5015399>