1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

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
This commit is contained in:
Mark Johnston 2017-10-27 17:05:14 +00:00
parent 61407763bc
commit cef5abd140
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=325044

View File

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