Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Mar 2015 11:14:13 +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: r280756 - head/sys/geom/mirror
Message-ID:  <201503271114.t2RBEDkn094845@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Fri Mar 27 11:14:12 2015
New Revision: 280756
URL: https://svnweb.freebsd.org/changeset/base/280756

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

Modified:
  head/sys/geom/mirror/g_mirror.c

Modified: head/sys/geom/mirror/g_mirror.c
==============================================================================
--- head/sys/geom/mirror/g_mirror.c	Fri Mar 27 09:32:34 2015	(r280755)
+++ head/sys/geom/mirror/g_mirror.c	Fri Mar 27 11:14:12 2015	(r280756)
@@ -1582,7 +1582,7 @@ g_mirror_request_split(struct g_mirror_s
 		cbp = g_clone_bio(bp);
 		if (cbp == NULL) {
 			while ((cbp = bioq_takefirst(&queue)) != NULL)
-				bioq_remove(&queue, cbp);
+				g_destroy_bio(cbp);;
 			if (bp->bio_error == 0)
 				bp->bio_error = ENOMEM;
 			g_io_deliver(bp, bp->bio_error);
@@ -1865,7 +1865,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) {
@@ -1893,7 +1893,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?201503271114.t2RBEDkn094845>