--- a/sys/dev/raid/hptmv/entry.c +++ b/sys/dev/raid/hptmv/entry.c @@ -2625,8 +2625,13 @@ static void hpt_timeout(void *arg) { - _VBUS_INST(&((PBUS_DMAMAP)((union ccb *)arg)->ccb_adapter)->pAdapter->VBus) - lock_driver(); + union ccb *ccb = (union ccb *)arg; + _VBUS_INST(&((PBUS_DMAMAP)ccb->ccb_adapter)->pAdapter->VBus) + if (lockmgr(&driver_lock, LK_EXCLUSIVE | LK_NOWAIT) != 0) { + /* avoid AB-BA with callout_stop() under driver_lock */ + callout_reset(ccb->ccb_h.timeout_ch, hz, hpt_timeout, arg); + return; + } fResetVBus(_VBUS_P0); unlock_driver(); }