aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2017-10-27 17:05:14 +0000
committerMark Johnston <markj@FreeBSD.org>2017-10-27 17:05:14 +0000
commitcef5abd140b08d001bce01c87b82a1b4ea506351 (patch)
tree9441ddb49f717f2143b2f72cbaf3ce0aa0551175
parent61407763bc3ec43a48cd99bd1819a81d4069e84a (diff)
downloadsrc-cef5abd140b08d001bce01c87b82a1b4ea506351.tar.gz
src-cef5abd140b08d001bce01c87b82a1b4ea506351.zip
Fix a lock leak in g_mirror_destroy().
g_mirror_destroy() is supposed to unlock the softc before indicating success, but it wasn't doing so if the caller raced with another thread destroying the mirror. MFC after: 1 week Sponsored by: Dell EMC Isilon
Notes
Notes: svn path=/head/; revision=325044
-rw-r--r--sys/geom/mirror/g_mirror.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c
index d9b7e4cdb445..7f8f670d7461 100644
--- a/sys/geom/mirror/g_mirror.c
+++ b/sys/geom/mirror/g_mirror.c
@@ -3088,8 +3088,10 @@ g_mirror_destroy(struct g_mirror_softc *sc, int how)
}
}
- if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROY) != 0)
+ if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROY) != 0) {
+ sx_xunlock(&sc->sc_lock);
return (0);
+ }
sc->sc_flags |= G_MIRROR_DEVICE_FLAG_DESTROY;
sc->sc_flags |= G_MIRROR_DEVICE_FLAG_DRAIN;
G_MIRROR_DEBUG(4, "%s: Waking up %p.", __func__, sc);