diff options
author | Mark Johnston <markj@FreeBSD.org> | 2017-10-27 17:05:14 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2017-10-27 17:05:14 +0000 |
commit | cef5abd140b08d001bce01c87b82a1b4ea506351 (patch) | |
tree | 9441ddb49f717f2143b2f72cbaf3ce0aa0551175 | |
parent | 61407763bc3ec43a48cd99bd1819a81d4069e84a (diff) | |
download | src-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.c | 4 |
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); |