Date: Thu, 7 Jan 2010 00:47:50 +0000 (UTC) From: Attilio Rao <attilio@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r201703 - head/sys/kern Message-ID: <201001070047.o070looW091014@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: attilio Date: Thu Jan 7 00:47:50 2010 New Revision: 201703 URL: http://svn.freebsd.org/changeset/base/201703 Log: Exclusive waiters sleeping with LK_SLEEPFAIL on and using interruptible sleeps/timeout may have left spourious lk_exslpfail counts on, so clean it up even when accessing a shared queue acquisition, giving to lk_exslpfail the value of 'upper limit'. In the worst case scenario, infact (mixed interruptible sleep / LK_SLEEPFAIL waiters) what may happen is that both queues are awaken even if that's not necessary, but still no harm. Reported by: Lucius Windschuh <lwindschuh at googlemail dot com> Reviewed by: kib Tested by: pho, Lucius Windschuh <lwindschuh at googlemail dot com> Modified: head/sys/kern/kern_lock.c Modified: head/sys/kern/kern_lock.c ============================================================================== --- head/sys/kern/kern_lock.c Thu Jan 7 00:44:54 2010 (r201702) +++ head/sys/kern/kern_lock.c Thu Jan 7 00:47:50 2010 (r201703) @@ -300,7 +300,14 @@ wakeupshlk(struct lock *lk, const char * } } else { - MPASS(lk->lk_exslpfail == 0); + + /* + * Exclusive waiters sleeping with LK_SLEEPFAIL on + * and using interruptible sleeps/timeout may have + * left spourious lk_exslpfail counts on, so clean + * it up anyway. + */ + lk->lk_exslpfail = 0; queue = SQ_SHARED_QUEUE; } @@ -959,7 +966,14 @@ __lockmgr_args(struct lock *lk, u_int fl queue = SQ_SHARED_QUEUE; } } else { - MPASS(lk->lk_exslpfail == 0); + + /* + * Exclusive waiters sleeping with LK_SLEEPFAIL + * on and using interruptible sleeps/timeout + * may have left spourious lk_exslpfail counts + * on, so clean it up anyway. + */ + lk->lk_exslpfail = 0; queue = SQ_SHARED_QUEUE; } @@ -1037,8 +1051,16 @@ __lockmgr_args(struct lock *lk, u_int fl queue = SQ_EXCLUSIVE_QUEUE; v &= ~LK_EXCLUSIVE_WAITERS; } else { + + /* + * Exclusive waiters sleeping with + * LK_SLEEPFAIL on and using + * interruptible sleeps/timeout may + * have left spourious lk_exslpfail + * counts on, so clean it up anyway. + */ MPASS(v & LK_SHARED_WAITERS); - MPASS(lk->lk_exslpfail == 0); + lk->lk_exslpfail = 0; queue = SQ_SHARED_QUEUE; v &= ~LK_SHARED_WAITERS; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001070047.o070looW091014>