]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/commit
MFC r200447,201703,201709-201710:
authorattilio <attilio@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 18 Jan 2010 14:43:44 +0000 (14:43 +0000)
committerattilio <attilio@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 18 Jan 2010 14:43:44 +0000 (14:43 +0000)
commitb0312d052a42e198a1d036eaad96c145360afb02
tree29709102e329809b88986c1b346983ccccdbc4eb
parent48d299da546877f0f0cf05f8afeeb8a61e88020e
MFC r200447,201703,201709-201710:
In current code, threads performing an interruptible sleep
will leave the waiters flag on forcing the owner to do a wakeup even
when the waiter queue is empty.
That operation may lead to a deadlock in the case of doing a fake wakeup
on the "preferred" queue while the other queue has real waiters on it,
because nobody is going to wakeup the 2nd queue waiters and they will
sleep indefinitively.
A similar bug, is present, for lockmgr in the case the waiters are
sleeping with LK_SLEEPFAIL on.

Add a sleepqueue interface which does report the actual number of waiters
on a specified queue of a waitchannel and track if at least one sleepfail
waiter is present or not. In presence of this or empty "preferred" queue,
wakeup both waiters queues.

Discussed with: kib
Tested by: Pete French <petefrench at ticketswitch dot com>,
Justin Head <justin at encarnate dot com>

git-svn-id: svn://svn.freebsd.org/base/stable/8@202576 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
share/man/man9/sleepqueue.9
sys/kern/kern_lock.c
sys/kern/kern_sx.c
sys/kern/subr_sleepqueue.c
sys/sys/lockmgr.h
sys/sys/sleepqueue.h