- 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.
This commit is contained in:
Pawel Jakub Dawidek 2004-08-02 00:37:40 +00:00
parent b23f72e98a
commit 969ff54d70

View file

@ -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) {