From owner-svn-src-all@FreeBSD.ORG Fri Apr 3 06:16:21 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 99CEE375; Fri, 3 Apr 2015 06:16:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 83E8A875; Fri, 3 Apr 2015 06:16:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t336GLrK055191; Fri, 3 Apr 2015 06:16:21 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t336GLrN055190; Fri, 3 Apr 2015 06:16:21 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201504030616.t336GLrN055190@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 3 Apr 2015 06:16:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r281012 - stable/10/sys/geom/mirror X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Apr 2015 06:16:21 -0000 Author: mav Date: Fri Apr 3 06:16:20 2015 New Revision: 281012 URL: https://svnweb.freebsd.org/changeset/base/281012 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/10/sys/geom/mirror/g_mirror.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/geom/mirror/g_mirror.c ============================================================================== --- stable/10/sys/geom/mirror/g_mirror.c Fri Apr 3 02:37:43 2015 (r281011) +++ stable/10/sys/geom/mirror/g_mirror.c Fri Apr 3 06:16:20 2015 (r281012) @@ -1588,7 +1588,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); @@ -1871,7 +1871,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) { @@ -1899,7 +1899,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 &&