From: matthew Date: Sat, 24 Jul 2010 04:01:52 +0000 (+0000) Subject: Get rid of scsi_deinit(), and change scsi_init() back to a one-time X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=94be64eb8ccc2875bf59bdf622031b7a83d4dd91;p=openbsd Get rid of scsi_deinit(), and change scsi_init() back to a one-time initialization strategy, rather than pretending to do user reference counting. Previously, we would re-initialize the SCSI pool(9)s, which had the fun consequence of causing sysctl(kern.pool.npools) to infinite loop at IPL_VM. ok krw@ --- diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c index cd1c23eda92..5d7d4f9ff91 100644 --- a/sys/scsi/scsi_base.c +++ b/sys/scsi/scsi_base.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi_base.c,v 1.185 2010/07/22 05:21:58 matthew Exp $ */ +/* $OpenBSD: scsi_base.c,v 1.186 2010/07/24 04:01:52 matthew Exp $ */ /* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */ /* @@ -63,7 +63,6 @@ void scsi_xs_sync_done(struct scsi_xfer *); #define DECODE_ASC_ASCQ 2 #define DECODE_SKSV 3 -int scsi_running = 0; struct pool scsi_xfer_pool; struct pool scsi_plug_pool; @@ -106,8 +105,11 @@ void scsi_io_get_done(void *, void *); void scsi_init() { - if (scsi_running++) + static int scsi_init_done; + + if (scsi_init_done) return; + scsi_init_done = 1; #if defined(SCSI_DELAY) && SCSI_DELAY > 0 /* Historical. Older buses may need a moment to stabilize. */ @@ -187,13 +189,6 @@ scsi_plug_detach(void *xsc, void *xp) pool_put(&scsi_plug_pool, p); } -void -scsi_deinit() -{ - if (--scsi_running) - return; -} - int scsi_sem_enter(struct mutex *mtx, u_int *running) { diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c index d9b7ce40e80..e88a63809c8 100644 --- a/sys/scsi/scsiconf.c +++ b/sys/scsi/scsiconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.c,v 1.161 2010/07/01 05:11:18 krw Exp $ */ +/* $OpenBSD: scsiconf.c,v 1.162 2010/07/24 04:01:52 matthew Exp $ */ /* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */ /* @@ -283,9 +283,6 @@ scsibusdetach(struct device *dev, int type) KASSERT(SLIST_EMPTY(&sb->sc_link)); - /* Free shared data. */ - scsi_deinit(); - return (0); } diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h index 86128367257..9610dee7122 100644 --- a/sys/scsi/scsiconf.h +++ b/sys/scsi/scsiconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.h,v 1.132 2010/07/22 00:31:06 krw Exp $ */ +/* $OpenBSD: scsiconf.h,v 1.133 2010/07/24 04:01:52 matthew Exp $ */ /* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */ /* @@ -542,7 +542,6 @@ const void *scsi_inqmatch(struct scsi_inquiry_data *, const void *, int, workq_add_task(NULL, (_fl), (_f), (_a1), (_a2)) void scsi_init(void); -void scsi_deinit(void); daddr64_t scsi_size(struct scsi_link *, int, u_int32_t *); int scsi_test_unit_ready(struct scsi_link *, int, int); int scsi_inquire(struct scsi_link *, struct scsi_inquiry_data *, int);