Reorder dacleanup() and cdcleanup() slightly so that the sysctl context is
freed while the periph lock is not held. While here, wait until after freeing the softc before reacquiring the periph lock. Tested by: sbruno
This commit is contained in:
parent
0b2ab5ec8e
commit
be246f9e94
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=188503
@ -401,11 +401,6 @@ cdcleanup(struct cam_periph *periph)
|
||||
|
||||
xpt_print(periph->path, "removing device entry\n");
|
||||
|
||||
if ((softc->flags & CD_FLAG_SCTX_INIT) != 0
|
||||
&& sysctl_ctx_free(&softc->sysctl_ctx) != 0) {
|
||||
xpt_print(periph->path, "can't remove sysctl context\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* In the queued, non-active case, the device in question
|
||||
* has already been removed from the changer run queue. Since this
|
||||
@ -474,9 +469,14 @@ cdcleanup(struct cam_periph *periph)
|
||||
free(softc->changer, M_DEVBUF);
|
||||
}
|
||||
cam_periph_unlock(periph);
|
||||
if ((softc->flags & CD_FLAG_SCTX_INIT) != 0
|
||||
&& sysctl_ctx_free(&softc->sysctl_ctx) != 0) {
|
||||
xpt_print(periph->path, "can't remove sysctl context\n");
|
||||
}
|
||||
|
||||
disk_destroy(softc->disk);
|
||||
cam_periph_lock(periph);
|
||||
free(softc, M_DEVBUF);
|
||||
cam_periph_lock(periph);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -995,6 +995,8 @@ dacleanup(struct cam_periph *periph)
|
||||
softc = (struct da_softc *)periph->softc;
|
||||
|
||||
xpt_print(periph->path, "removing device entry\n");
|
||||
cam_periph_unlock(periph);
|
||||
|
||||
/*
|
||||
* If we can't free the sysctl tree, oh well...
|
||||
*/
|
||||
@ -1003,11 +1005,10 @@ dacleanup(struct cam_periph *periph)
|
||||
xpt_print(periph->path, "can't remove sysctl context\n");
|
||||
}
|
||||
|
||||
cam_periph_unlock(periph);
|
||||
disk_destroy(softc->disk);
|
||||
callout_drain(&softc->sendordered_c);
|
||||
cam_periph_lock(periph);
|
||||
free(softc, M_DEVBUF);
|
||||
cam_periph_lock(periph);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user