kern/113957: commit references a PR

dfilter service dfilter at FreeBSD.ORG
Tue Jan 29 17:30:01 UTC 2013


The following reply was made to PR kern/113957; it has been noted by GNATS.

From: dfilter at FreeBSD.ORG (dfilter service)
To: bug-followup at FreeBSD.org
Cc:  
Subject: Re: kern/113957: commit references a PR
Date: Tue, 29 Jan 2013 17:20:57 +0000 (UTC)

 Author: mav
 Date: Tue Jan 29 17:20:49 2013
 New Revision: 246076
 URL: http://svnweb.freebsd.org/changeset/base/246076
 
 Log:
   MFC r245443:
   Alike to r242314 for GRAID make GMIRROR more aggressive in marking volumes
   as clean on shutdown and move that action from shutdown_pre_sync stage to
   shutdown_post_sync to avoid extra flapping.
   
   ZFS tends to not close devices on shutdown, that doesn't allow GEOM MIRROR
   to shutdown gracefully.  To handle that, mark volume as clean just when
   shutdown time comes and there are no active writes.
   
   PR:             kern/113957
 
 Modified:
   stable/9/sys/geom/mirror/g_mirror.c
 Directory Properties:
   stable/9/sys/   (props changed)
 
 Modified: stable/9/sys/geom/mirror/g_mirror.c
 ==============================================================================
 --- stable/9/sys/geom/mirror/g_mirror.c	Tue Jan 29 17:05:21 2013	(r246075)
 +++ stable/9/sys/geom/mirror/g_mirror.c	Tue Jan 29 17:20:49 2013	(r246076)
 @@ -80,7 +80,8 @@ SYSCTL_UINT(_kern_geom_mirror, OID_AUTO,
  	G_MIRROR_DEBUG(4, "%s: Woken up %p.", __func__, (ident));	\
  } while (0)
  
 -static eventhandler_tag g_mirror_pre_sync = NULL;
 +static eventhandler_tag g_mirror_post_sync = NULL;
 +static int g_mirror_shutdown = 0;
  
  static int g_mirror_destroy_geom(struct gctl_req *req, struct g_class *mp,
      struct g_geom *gp);
 @@ -814,7 +815,7 @@ g_mirror_idle(struct g_mirror_softc *sc,
  		return (0);
  	if (acw > 0 || (acw == -1 && sc->sc_provider->acw > 0)) {
  		timeout = g_mirror_idletime - (time_uptime - sc->sc_last_write);
 -		if (timeout > 0)
 +		if (!g_mirror_shutdown && timeout > 0)
  			return (timeout);
  	}
  	sc->sc_idle = 1;
 @@ -2820,7 +2821,7 @@ g_mirror_access(struct g_provider *pp, i
  			error = ENXIO;
  		goto end;
  	}
 -	if (dcw == 0 && !sc->sc_idle)
 +	if (dcw == 0)
  		g_mirror_idle(sc, dcw);
  	if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROYING) != 0) {
  		if (acr > 0 || acw > 0 || ace > 0) {
 @@ -3231,7 +3232,7 @@ g_mirror_dumpconf(struct sbuf *sb, const
  }
  
  static void
 -g_mirror_shutdown_pre_sync(void *arg, int howto)
 +g_mirror_shutdown_post_sync(void *arg, int howto)
  {
  	struct g_class *mp;
  	struct g_geom *gp, *gp2;
 @@ -3241,6 +3242,7 @@ g_mirror_shutdown_pre_sync(void *arg, in
  	mp = arg;
  	DROP_GIANT();
  	g_topology_lock();
 +	g_mirror_shutdown = 1;
  	LIST_FOREACH_SAFE(gp, &mp->geom, geom, gp2) {
  		if ((sc = gp->softc) == NULL)
  			continue;
 @@ -3249,6 +3251,7 @@ g_mirror_shutdown_pre_sync(void *arg, in
  			continue;
  		g_topology_unlock();
  		sx_xlock(&sc->sc_lock);
 +		g_mirror_idle(sc, -1);
  		g_cancel_event(sc);
  		error = g_mirror_destroy(sc, G_MIRROR_DESTROY_DELAYED);
  		if (error != 0)
 @@ -3263,9 +3266,9 @@ static void
  g_mirror_init(struct g_class *mp)
  {
  
 -	g_mirror_pre_sync = EVENTHANDLER_REGISTER(shutdown_pre_sync,
 -	    g_mirror_shutdown_pre_sync, mp, SHUTDOWN_PRI_FIRST);
 -	if (g_mirror_pre_sync == NULL)
 +	g_mirror_post_sync = EVENTHANDLER_REGISTER(shutdown_post_sync,
 +	    g_mirror_shutdown_post_sync, mp, SHUTDOWN_PRI_FIRST);
 +	if (g_mirror_post_sync == NULL)
  		G_MIRROR_DEBUG(0, "Warning! Cannot register shutdown event.");
  }
  
 @@ -3273,8 +3276,8 @@ static void
  g_mirror_fini(struct g_class *mp)
  {
  
 -	if (g_mirror_pre_sync != NULL)
 -		EVENTHANDLER_DEREGISTER(shutdown_pre_sync, g_mirror_pre_sync);
 +	if (g_mirror_post_sync != NULL)
 +		EVENTHANDLER_DEREGISTER(shutdown_post_sync, g_mirror_post_sync);
  }
  
  DECLARE_GEOM_CLASS(g_mirror_class, g_mirror);
 _______________________________________________
 svn-src-all at freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe at freebsd.org"
 


More information about the freebsd-geom mailing list