From 1f7fec3cb579a2be476ff88078b7e10380c9af13 Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Mon, 3 Jul 2006 10:32:38 +0000 Subject: [PATCH] Allow to close access even if device is already destroyed. Reported by: Ulrich Spoerlein PR: kern/98093 MFC after: 1 week --- sys/geom/mirror/g_mirror.c | 8 +++++--- sys/geom/raid3/g_raid3.c | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c index 27c6b8869770..aa80d2cb1ddf 100644 --- a/sys/geom/mirror/g_mirror.c +++ b/sys/geom/mirror/g_mirror.c @@ -2736,13 +2736,15 @@ g_mirror_access(struct g_provider *pp, int acr, int acw, int ace) G_MIRROR_DEBUG(2, "Access request for %s: r%dw%de%d.", pp->name, acr, acw, ace); + sc = pp->geom->softc; + if (sc == NULL && acr <= 0 && acw <= 0 && ace <= 0) + return (0); + KASSERT(sc != NULL, ("NULL softc (provider=%s).", pp->name)); + dcr = pp->acr + acr; dcw = pp->acw + acw; dce = pp->ace + ace; - sc = pp->geom->softc; - KASSERT(sc != NULL, ("NULL softc (provider=%s).", pp->name)); - g_topology_unlock(); sx_xlock(&sc->sc_lock); if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROY) != 0 || diff --git a/sys/geom/raid3/g_raid3.c b/sys/geom/raid3/g_raid3.c index e18497294b24..11d82c6f1a2e 100644 --- a/sys/geom/raid3/g_raid3.c +++ b/sys/geom/raid3/g_raid3.c @@ -2949,13 +2949,15 @@ g_raid3_access(struct g_provider *pp, int acr, int acw, int ace) G_RAID3_DEBUG(2, "Access request for %s: r%dw%de%d.", pp->name, acr, acw, ace); + sc = pp->geom->softc; + if (sc == NULL && acr <= 0 && acw <= 0 && ace <= 0) + return (0); + KASSERT(sc != NULL, ("NULL softc (provider=%s).", pp->name)); + dcr = pp->acr + acr; dcw = pp->acw + acw; dce = pp->ace + ace; - sc = pp->geom->softc; - KASSERT(sc != NULL, ("NULL softc (provider=%s).", pp->name)); - g_topology_unlock(); sx_xlock(&sc->sc_lock); if ((sc->sc_flags & G_RAID3_DEVICE_FLAG_DESTROY) != 0 ||