Date: Thu, 1 Sep 2016 07:15:23 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r305181 - stable/11/sys/kern Message-ID: <201609010715.u817FNRh040359@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Thu Sep 1 07:15:23 2016 New Revision: 305181 URL: https://svnweb.freebsd.org/changeset/base/305181 Log: MFC r304812: In both do_rw_wrlock() and do_rw_rdlock(), do not obliterate possible error from sleep. Modified: stable/11/sys/kern/kern_umtx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_umtx.c ============================================================================== --- stable/11/sys/kern/kern_umtx.c Thu Sep 1 07:08:01 2016 (r305180) +++ stable/11/sys/kern/kern_umtx.c Thu Sep 1 07:15:23 2016 (r305181) @@ -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?201609010715.u817FNRh040359>