mps/mpr(4): Move xpt_register_async() out of lock.
It fixes lock ordere reversal between SIM and device locks. Also remove registration for AC_FOUND_DEVICE, unused for a while now. MFC after: 1 month
This commit is contained in:
parent
5dc5f849be
commit
02d8194012
@ -821,6 +821,8 @@ mpr_attach_sas(struct mpr_softc *sc)
|
||||
|
||||
callout_init(&sassc->discovery_callout, 1 /*mpsafe*/);
|
||||
|
||||
mpr_unlock(sc);
|
||||
|
||||
/*
|
||||
* Register for async events so we can determine the EEDP
|
||||
* capabilities of devices.
|
||||
@ -835,7 +837,7 @@ mpr_attach_sas(struct mpr_softc *sc)
|
||||
} else {
|
||||
int event;
|
||||
|
||||
event = AC_ADVINFO_CHANGED | AC_FOUND_DEVICE;
|
||||
event = AC_ADVINFO_CHANGED;
|
||||
status = xpt_register_async(event, mprsas_async, sc,
|
||||
sassc->path);
|
||||
|
||||
@ -855,8 +857,6 @@ mpr_attach_sas(struct mpr_softc *sc)
|
||||
mpr_printf(sc, "EEDP capabilities disabled.\n");
|
||||
}
|
||||
|
||||
mpr_unlock(sc);
|
||||
|
||||
mprsas_register_events(sc);
|
||||
out:
|
||||
if (error)
|
||||
@ -890,12 +890,6 @@ mpr_detach_sas(struct mpr_softc *sc)
|
||||
if (sassc->ev_tq != NULL)
|
||||
taskqueue_free(sassc->ev_tq);
|
||||
|
||||
/* Make sure CAM doesn't wedge if we had to bail out early. */
|
||||
mpr_lock(sc);
|
||||
|
||||
while (sassc->startup_refcount != 0)
|
||||
mprsas_startup_decrement(sassc);
|
||||
|
||||
/* Deregister our async handler */
|
||||
if (sassc->path != NULL) {
|
||||
xpt_register_async(0, mprsas_async, sc, sassc->path);
|
||||
@ -903,6 +897,12 @@ mpr_detach_sas(struct mpr_softc *sc)
|
||||
sassc->path = NULL;
|
||||
}
|
||||
|
||||
/* Make sure CAM doesn't wedge if we had to bail out early. */
|
||||
mpr_lock(sc);
|
||||
|
||||
while (sassc->startup_refcount != 0)
|
||||
mprsas_startup_decrement(sassc);
|
||||
|
||||
if (sassc->flags & MPRSAS_IN_STARTUP)
|
||||
xpt_release_simq(sassc->sim, 1);
|
||||
|
||||
@ -3326,6 +3326,7 @@ mprsas_async(void *callback_arg, uint32_t code, struct cam_path *path,
|
||||
|
||||
sc = (struct mpr_softc *)callback_arg;
|
||||
|
||||
mpr_lock(sc);
|
||||
switch (code) {
|
||||
case AC_ADVINFO_CHANGED: {
|
||||
struct mprsas_target *target;
|
||||
@ -3413,10 +3414,10 @@ mprsas_async(void *callback_arg, uint32_t code, struct cam_path *path,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AC_FOUND_DEVICE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
mpr_unlock(sc);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -779,6 +779,8 @@ mps_attach_sas(struct mps_softc *sc)
|
||||
|
||||
callout_init(&sassc->discovery_callout, 1 /*mpsafe*/);
|
||||
|
||||
mps_unlock(sc);
|
||||
|
||||
/*
|
||||
* Register for async events so we can determine the EEDP
|
||||
* capabilities of devices.
|
||||
@ -812,8 +814,6 @@ mps_attach_sas(struct mps_softc *sc)
|
||||
mps_printf(sc, "EEDP capabilities disabled.\n");
|
||||
}
|
||||
|
||||
mps_unlock(sc);
|
||||
|
||||
mpssas_register_events(sc);
|
||||
out:
|
||||
if (error)
|
||||
@ -847,12 +847,6 @@ mps_detach_sas(struct mps_softc *sc)
|
||||
if (sassc->ev_tq != NULL)
|
||||
taskqueue_free(sassc->ev_tq);
|
||||
|
||||
/* Make sure CAM doesn't wedge if we had to bail out early. */
|
||||
mps_lock(sc);
|
||||
|
||||
while (sassc->startup_refcount != 0)
|
||||
mpssas_startup_decrement(sassc);
|
||||
|
||||
/* Deregister our async handler */
|
||||
if (sassc->path != NULL) {
|
||||
xpt_register_async(0, mpssas_async, sc, sassc->path);
|
||||
@ -860,6 +854,12 @@ mps_detach_sas(struct mps_softc *sc)
|
||||
sassc->path = NULL;
|
||||
}
|
||||
|
||||
/* Make sure CAM doesn't wedge if we had to bail out early. */
|
||||
mps_lock(sc);
|
||||
|
||||
while (sassc->startup_refcount != 0)
|
||||
mpssas_startup_decrement(sassc);
|
||||
|
||||
if (sassc->flags & MPSSAS_IN_STARTUP)
|
||||
xpt_release_simq(sassc->sim, 1);
|
||||
|
||||
@ -3150,6 +3150,7 @@ mpssas_async(void *callback_arg, uint32_t code, struct cam_path *path,
|
||||
|
||||
sc = (struct mps_softc *)callback_arg;
|
||||
|
||||
mps_lock(sc);
|
||||
switch (code) {
|
||||
case AC_ADVINFO_CHANGED: {
|
||||
struct mpssas_target *target;
|
||||
@ -3241,6 +3242,7 @@ mpssas_async(void *callback_arg, uint32_t code, struct cam_path *path,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
mps_unlock(sc);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user