svn commit: r325044 - head/sys/geom/mirror

Mark Johnston markj at FreeBSD.org
Fri Oct 27 17:05:15 UTC 2017


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


More information about the svn-src-all mailing list