summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2016-09-01 07:21:42 +0000
committerkib <kib@FreeBSD.org>2016-09-01 07:21:42 +0000
commit3f022705afd922bf7ba19549229f6a213f900fc8 (patch)
treeed160db475f350e044374031fffcf98f2781f15e /sys/kern
parentb69eb90edd8f905bb048614e52acaabcedd8eba2 (diff)
downloadFreeBSD-src-3f022705afd922bf7ba19549229f6a213f900fc8.zip
FreeBSD-src-3f022705afd922bf7ba19549229f6a213f900fc8.tar.gz
MFC r304812:
In both do_rw_wrlock() and do_rw_rdlock(), do not obliterate possible error from sleep.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_umtx.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c
index f871d41..7a621fb 100644
--- a/sys/kern/kern_umtx.c
+++ b/sys/kern/kern_umtx.c
@@ -2831,7 +2831,7 @@ do_rw_rdlock(struct thread *td, struct urwlock *rwlock, long fflag, struct _umtx
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);
@@ -2980,9 +2980,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;
+ }
}
}
@@ -3005,7 +3008,7 @@ do_rw_wrlock(struct thread *td, struct urwlock *rwlock, struct _umtx_time *timeo
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);
@@ -3151,14 +3154,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);
OpenPOWER on IntegriCloud