Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Apr 2015 13:09:06 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r281310 - in head/sys: geom geom/multipath vm
Message-ID:  <201504091309.t39D96RA098295@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Thu Apr  9 13:09:05 2015
New Revision: 281310
URL: https://svnweb.freebsd.org/changeset/base/281310

Log:
  Remove sleeps from geom_up thread on device destruction.
  
  MFC after:	3 days.

Modified:
  head/sys/geom/geom_dev.c
  head/sys/geom/multipath/g_multipath.c
  head/sys/vm/swap_pager.c

Modified: head/sys/geom/geom_dev.c
==============================================================================
--- head/sys/geom/geom_dev.c	Thu Apr  9 12:57:58 2015	(r281309)
+++ head/sys/geom/geom_dev.c	Thu Apr  9 13:09:05 2015	(r281310)
@@ -572,7 +572,7 @@ g_dev_done(struct bio *bp2)
 	}
 	mtx_unlock(&sc->sc_mtx);
 	if (destroy)
-		g_post_event(g_dev_destroy, cp, M_WAITOK, NULL);
+		g_post_event(g_dev_destroy, cp, M_NOWAIT, NULL);
 	biodone(bp);
 }
 

Modified: head/sys/geom/multipath/g_multipath.c
==============================================================================
--- head/sys/geom/multipath/g_multipath.c	Thu Apr  9 12:57:58 2015	(r281309)
+++ head/sys/geom/multipath/g_multipath.c	Thu Apr  9 13:09:05 2015	(r281310)
@@ -369,9 +369,9 @@ g_multipath_done(struct bio *bp)
 		mtx_lock(&sc->sc_mtx);
 		(*cnt)--;
 		if (*cnt == 0 && (cp->index & MP_LOST)) {
-			cp->index |= MP_POSTED;
+			if (g_post_event(g_mpd, cp, M_NOWAIT, NULL) == 0)
+				cp->index |= MP_POSTED;
 			mtx_unlock(&sc->sc_mtx);
-			g_post_event(g_mpd, cp, M_WAITOK, NULL);
 		} else
 			mtx_unlock(&sc->sc_mtx);
 		g_std_done(bp);

Modified: head/sys/vm/swap_pager.c
==============================================================================
--- head/sys/vm/swap_pager.c	Thu Apr  9 12:57:58 2015	(r281309)
+++ head/sys/vm/swap_pager.c	Thu Apr  9 13:09:05 2015	(r281310)
@@ -2579,7 +2579,6 @@ swapgeom_done(struct bio *bp2)
 	struct swdevt *sp;
 	struct buf *bp;
 	struct g_consumer *cp;
-	int destroy;
 
 	bp = bp2->bio_caller2;
 	cp = bp2->bio_from;
@@ -2590,15 +2589,14 @@ swapgeom_done(struct bio *bp2)
 	bp->b_error = bp2->bio_error;
 	bufdone(bp);
 	mtx_lock(&sw_dev_mtx);
-	destroy = ((--cp->index) == 0 && cp->private);
-	if (destroy) {
-		sp = bp2->bio_caller1;
-		sp->sw_id = NULL;
+	if ((--cp->index) == 0 && cp->private) {
+		if (g_post_event(swapgeom_close_ev, cp, M_NOWAIT, NULL) == 0) {
+			sp = bp2->bio_caller1;
+			sp->sw_id = NULL;
+		}
 	}
 	mtx_unlock(&sw_dev_mtx);
 	g_destroy_bio(bp2);
-	if (destroy)
-		g_waitfor_event(swapgeom_close_ev, cp, M_WAITOK, NULL);
 }
 
 static void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504091309.t39D96RA098295>