Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Apr 2015 06:17:25 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r281013 - stable/9/sys/geom/mirror
Message-ID:  <201504030617.t336HPJ7055396@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Fri Apr  3 06:17:24 2015
New Revision: 281013
URL: https://svnweb.freebsd.org/changeset/base/281013

Log:
  MFC r280756, r280758: Fix bug on memory allocation error in split method.
  
  While there, use bioq_takefirst() in place where it is convenient.

Modified:
  stable/9/sys/geom/mirror/g_mirror.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/mirror/g_mirror.c
==============================================================================
--- stable/9/sys/geom/mirror/g_mirror.c	Fri Apr  3 06:16:20 2015	(r281012)
+++ stable/9/sys/geom/mirror/g_mirror.c	Fri Apr  3 06:17:24 2015	(r281013)
@@ -1542,7 +1542,7 @@ g_mirror_request_split(struct g_mirror_s
 		if (cbp == NULL) {
 			for (cbp = bioq_first(&queue); cbp != NULL;
 			    cbp = bioq_first(&queue)) {
-				bioq_remove(&queue, cbp);
+				g_destroy_bio(cbp);
 				g_destroy_bio(cbp);
 			}
 			if (bp->bio_error == 0)
@@ -1829,7 +1829,7 @@ g_mirror_worker(void *arg)
 		 */
 		/* Get first request from the queue. */
 		mtx_lock(&sc->sc_queue_mtx);
-		bp = bioq_first(&sc->sc_queue);
+		bp = bioq_takefirst(&sc->sc_queue);
 		if (bp == NULL) {
 			if ((sc->sc_flags &
 			    G_MIRROR_DEVICE_FLAG_DESTROY) != 0) {
@@ -1857,7 +1857,6 @@ g_mirror_worker(void *arg)
 			G_MIRROR_DEBUG(5, "%s: I'm here 4.", __func__);
 			continue;
 		}
-		bioq_remove(&sc->sc_queue, bp);
 		mtx_unlock(&sc->sc_queue_mtx);
 
 		if (bp->bio_from->geom == sc->sc_sync.ds_geom &&



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