From b9c4e3dc5895ffc3ca5d1d9a64953bc84d5a2f2b Mon Sep 17 00:00:00 2001 From: scottl Date: Tue, 30 Jul 2013 23:50:09 +0000 Subject: Fix r253823. Some WIP patches snuck in. Submitted by: zont --- sys/kern/kern_mutex.c | 20 ++++++-------------- sys/kern/subr_uio.c | 8 +------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index cd1ed7d..a613da8 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -218,14 +218,13 @@ __mtx_lock_flags(volatile uintptr_t *c, int opts, const char *file, int line) KASSERT(LOCK_CLASS(&m->lock_object) == &lock_class_mtx_sleep, ("mtx_lock() of spin mutex %s @ %s:%d", m->lock_object.lo_name, file, line)); - WITNESS_CHECKORDER(&m->lock_object, (opts & ~MTX_RECURSE) | - LOP_NEWORDER | LOP_EXCLUSIVE, file, line, NULL); + WITNESS_CHECKORDER(&m->lock_object, opts | LOP_NEWORDER | LOP_EXCLUSIVE, + file, line, NULL); __mtx_lock(m, curthread, opts, file, line); LOCK_LOG_LOCK("LOCK", &m->lock_object, opts, m->mtx_recurse, file, line); - WITNESS_LOCK(&m->lock_object, (opts & ~MTX_RECURSE) | LOP_EXCLUSIVE, - file, line); + WITNESS_LOCK(&m->lock_object, opts | LOP_EXCLUSIVE, file, line); curthread->td_locks++; } @@ -272,11 +271,9 @@ __mtx_lock_spin_flags(volatile uintptr_t *c, int opts, const char *file, ("mtx_lock_spin() of sleep mutex %s @ %s:%d", m->lock_object.lo_name, file, line)); if (mtx_owned(m)) - KASSERT((m->lock_object.lo_flags & LO_RECURSABLE) != 0 || - (opts & MTX_RECURSE) != 0, + KASSERT((m->lock_object.lo_flags & LO_RECURSABLE) != 0, ("mtx_lock_spin: recursed on non-recursive mutex %s @ %s:%d\n", m->lock_object.lo_name, file, line)); - opts &= ~MTX_RECURSE; WITNESS_CHECKORDER(&m->lock_object, opts | LOP_NEWORDER | LOP_EXCLUSIVE, file, line, NULL); __mtx_lock_spin(m, curthread, opts, file, line); @@ -338,14 +335,12 @@ _mtx_trylock_flags_(volatile uintptr_t *c, int opts, const char *file, int line) ("mtx_trylock() of spin mutex %s @ %s:%d", m->lock_object.lo_name, file, line)); - if (mtx_owned(m) && ((m->lock_object.lo_flags & LO_RECURSABLE) != 0 || - (opts & MTX_RECURSE) != 0)) { + if (mtx_owned(m) && (m->lock_object.lo_flags & LO_RECURSABLE) != 0) { m->mtx_recurse++; atomic_set_ptr(&m->mtx_lock, MTX_RECURSED); rval = 1; } else rval = _mtx_obtain_lock(m, (uintptr_t)curthread); - opts &= ~MTX_RECURSE; LOCK_LOG_TRY("LOCK", &m->lock_object, opts, rval, file, line); if (rval) { @@ -396,18 +391,15 @@ __mtx_lock_sleep(volatile uintptr_t *c, uintptr_t tid, int opts, m = mtxlock2mtx(c); if (mtx_owned(m)) { - KASSERT((m->lock_object.lo_flags & LO_RECURSABLE) != 0 || - (opts & MTX_RECURSE) != 0, + KASSERT((m->lock_object.lo_flags & LO_RECURSABLE) != 0, ("_mtx_lock_sleep: recursed on non-recursive mutex %s @ %s:%d\n", m->lock_object.lo_name, file, line)); - opts &= ~MTX_RECURSE; m->mtx_recurse++; atomic_set_ptr(&m->mtx_lock, MTX_RECURSED); if (LOCK_LOG_TEST(&m->lock_object, opts)) CTR1(KTR_LOCK, "_mtx_lock_sleep: %p recursing", m); return; } - opts &= ~MTX_RECURSE; #ifdef HWPMC_HOOKS PMC_SOFT_CALL( , , lock, failed); diff --git a/sys/kern/subr_uio.c b/sys/kern/subr_uio.c index efa483f..1ee265c 100644 --- a/sys/kern/subr_uio.c +++ b/sys/kern/subr_uio.c @@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #ifdef SOCKET_SEND_COW #include @@ -123,12 +122,7 @@ retry: if (uobject->backing_object != NULL) pmap_remove(map->pmap, uaddr, uaddr + PAGE_SIZE); } - if (vm_page_insert(kern_pg, uobject, upindex)) { - VM_OBJECT_WUNLOCK(uobject); - VM_WAIT; - VM_OBJECT_WLOCK(uobject); - goto retry; - } + vm_page_insert(kern_pg, uobject, upindex); vm_page_dirty(kern_pg); VM_OBJECT_WUNLOCK(uobject); vm_map_lookup_done(map, entry); -- cgit v1.1