Date: Fri, 27 Oct 2017 17:05:14 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325044 - head/sys/geom/mirror Message-ID: <201710271705.v9RH5EuZ064711@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Fri Oct 27 17:05:14 2017 New Revision: 325044 URL: https://svnweb.freebsd.org/changeset/base/325044 Log: 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 Modified: head/sys/geom/mirror/g_mirror.c Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Fri Oct 27 16:36:05 2017 (r325043) +++ head/sys/geom/mirror/g_mirror.c Fri Oct 27 17:05:14 2017 (r325044) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710271705.v9RH5EuZ064711>