Date: Sun, 15 Aug 2010 20:34:51 +0000 (UTC) From: Navdeep Parhar <np@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r211345 - head/sys/dev/cxgb Message-ID: <201008152034.o7FKYpmG070847@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: np Date: Sun Aug 15 20:34:51 2010 New Revision: 211345 URL: http://svn.freebsd.org/changeset/base/211345 Log: wakeup is required if the adapter lock is released anywhere during init and not just for the may_sleep case. Pointed out by: Isilon MFC after: 3 days Modified: head/sys/dev/cxgb/cxgb_main.c Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Sun Aug 15 19:07:44 2010 (r211344) +++ head/sys/dev/cxgb/cxgb_main.c Sun Aug 15 20:34:51 2010 (r211345) @@ -1778,11 +1778,12 @@ cxgb_init_locked(struct port_info *p) struct adapter *sc = p->adapter; struct ifnet *ifp = p->ifp; struct cmac *mac = &p->mac; - int i, rc = 0, may_sleep = 0; + int i, rc = 0, may_sleep = 0, gave_up_lock = 0; ADAPTER_LOCK_ASSERT_OWNED(sc); while (!IS_DOOMED(p) && IS_BUSY(sc)) { + gave_up_lock = 1; if (mtx_sleep(&sc->flags, &sc->lock, PCATCH, "cxgbinit", 0)) { rc = EINTR; goto done; @@ -1802,6 +1803,7 @@ cxgb_init_locked(struct port_info *p) if (may_sleep) { SET_BUSY(sc); + gave_up_lock = 1; ADAPTER_UNLOCK(sc); } @@ -1849,8 +1851,9 @@ done: ADAPTER_LOCK(sc); KASSERT(IS_BUSY(sc), ("%s: controller not busy.", __func__)); CLR_BUSY(sc); - wakeup_one(&sc->flags); } + if (gave_up_lock) + wakeup_one(&sc->flags); ADAPTER_UNLOCK(sc); return (rc); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008152034.o7FKYpmG070847>