mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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
This commit is contained in:
parent
071c626eed
commit
61cb6c9076
1 changed files with 5 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue