diff options
author | jhb <jhb@FreeBSD.org> | 2009-02-11 22:29:09 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2009-02-11 22:29:09 +0000 |
commit | f1859b93d6bac611f1160ed483c51756acae567a (patch) | |
tree | 39666253f7d03340e140bd66cb017a16fbc19421 /sys/cam | |
parent | 4a2859b3bea291207bb5f899037462724007ec61 (diff) | |
download | FreeBSD-src-f1859b93d6bac611f1160ed483c51756acae567a.zip FreeBSD-src-f1859b93d6bac611f1160ed483c51756acae567a.tar.gz |
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
Diffstat (limited to 'sys/cam')
-rw-r--r-- | sys/cam/scsi/scsi_cd.c | 12 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_da.c | 5 |
2 files changed, 9 insertions, 8 deletions
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index 844baba..a095d82 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -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 diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index 012d46d..beb517e 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -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 |