From 2c2bebfcb3131416432816eeb9eeeab2e017d09f Mon Sep 17 00:00:00 2001 From: Attilio Rao Date: Sat, 24 Nov 2007 04:22:28 +0000 Subject: [PATCH] transferlockers() is a very dangerous and hack-ish function as waiters should never be moved by one lock to another. As, luckily, nothing in our tree is using it, axe the function. This breaks lockmgr KPI, so interested, third-party modules should update their source code with appropriate replacement. Ok'ed by: ups, rwatson MFC after: 3 days --- sys/kern/kern_lock.c | 28 ---------------------------- sys/sys/lockmgr.h | 1 - 2 files changed, 29 deletions(-) diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index 6a5f213c177..b06e17ea561 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -505,34 +505,6 @@ acquiredrain(struct lock *lkp, int extflags) { return 0; } -/* - * Transfer any waiting processes from one lock to another. - */ -void -transferlockers(from, to) - struct lock *from; - struct lock *to; -{ - - KASSERT(from != to, ("lock transfer to self")); - KASSERT((from->lk_flags&LK_WAITDRAIN) == 0, ("transfer draining lock")); - - mtx_lock(from->lk_interlock); - if (from->lk_waitcount == 0) { - mtx_unlock(from->lk_interlock); - return; - } - from->lk_newlock = to; - wakeup((void *)from); - msleep(&from->lk_newlock, from->lk_interlock, from->lk_prio, - "lkxfer", 0); - from->lk_newlock = NULL; - from->lk_flags &= ~(LK_WANT_EXCL | LK_WANT_UPGRADE); - KASSERT(from->lk_waitcount == 0, ("active lock")); - mtx_unlock(from->lk_interlock); -} - - /* * Initialize a lock; required before use. */ diff --git a/sys/sys/lockmgr.h b/sys/sys/lockmgr.h index 79a51308fdc..9765c364f0c 100644 --- a/sys/sys/lockmgr.h +++ b/sys/sys/lockmgr.h @@ -204,7 +204,6 @@ void lockdestroy(struct lock *); int _lockmgr(struct lock *, u_int flags, struct mtx *, struct thread *p, char *file, int line); -void transferlockers(struct lock *, struct lock *); void lockmgr_printinfo(struct lock *); int lockstatus(struct lock *, struct thread *); int lockcount(struct lock *);