summaryrefslogtreecommitdiffstats
path: root/sys/geom/nop
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2004-08-02 00:37:40 +0000
committerpjd <pjd@FreeBSD.org>2004-08-02 00:37:40 +0000
commit889eca7e19abe854dd1e5724df8f205abcc6c152 (patch)
tree83dbef63b8570514aa4562bebcb9839bc934bff3 /sys/geom/nop
parent9532ab7116a36e60ae15ec463c757a7d2e7f9b39 (diff)
downloadFreeBSD-src-889eca7e19abe854dd1e5724df8f205abcc6c152.zip
FreeBSD-src-889eca7e19abe854dd1e5724df8f205abcc6c152.tar.gz
- Fix unloading by the same way it is done in my other classes:
set gp->softc to NULL and return ENXIO when it is NULL, so GEOM will not panic or hang, but unload one device on every 'unload'. This make 'unload' command usable, but it have to be executed <number of devices> + 1 times. - Made use of 'pp' variable.
Diffstat (limited to 'sys/geom/nop')
-rw-r--r--sys/geom/nop/g_nop.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/geom/nop/g_nop.c b/sys/geom/nop/g_nop.c
index c9e53ea..bedc2ef 100644
--- a/sys/geom/nop/g_nop.c
+++ b/sys/geom/nop/g_nop.c
@@ -85,8 +85,6 @@ g_nop_start(struct bio *bp)
g_io_deliver(bp, ENOMEM);
return;
}
- pp = LIST_FIRST(&gp->provider);
- KASSERT(pp != NULL, ("NULL pp"));
if (sc->sc_failprob > 0) {
u_int rval;
@@ -100,7 +98,9 @@ g_nop_start(struct bio *bp)
cbp->bio_offset = bp->bio_offset + sc->sc_offset;
cbp->bio_data = bp->bio_data;
cbp->bio_length = bp->bio_length;
- cbp->bio_to = LIST_FIRST(&gp->provider);
+ pp = LIST_FIRST(&gp->provider);
+ KASSERT(pp != NULL, ("NULL pp"));
+ cbp->bio_to = pp;
G_NOP_LOGREQ(cbp, "Sending request.");
g_io_request(cbp, LIST_FIRST(&gp->consumer));
}
@@ -228,6 +228,8 @@ g_nop_destroy(struct g_geom *gp, boolean_t force)
struct g_provider *pp;
g_topology_assert();
+ if (gp->softc == NULL)
+ return (ENXIO);
pp = LIST_FIRST(&gp->provider);
if (pp != NULL && (pp->acr != 0 || pp->acw != 0 || pp->ace != 0)) {
if (force) {
OpenPOWER on IntegriCloud