From owner-svn-src-head@freebsd.org Mon Jan 27 13:15:17 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F3DA1F6207; Mon, 27 Jan 2020 13:15:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 485qx06hxVz4Mmk; Mon, 27 Jan 2020 13:15:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E12E9A787; Mon, 27 Jan 2020 13:15:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00RDFGP5027850; Mon, 27 Jan 2020 13:15:16 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00RDFGcZ027848; Mon, 27 Jan 2020 13:15:16 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202001271315.00RDFGcZ027848@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 27 Jan 2020 13:15:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r357172 - in head/sys/geom: . stripe X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys/geom: . stripe X-SVN-Commit-Revision: 357172 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jan 2020 13:15:17 -0000 Author: kib Date: Mon Jan 27 13:15:16 2020 New Revision: 357172 URL: https://svnweb.freebsd.org/changeset/base/357172 Log: Fix aggregating geoms for BIO_SPEEDUP. If the bio was split into several bios going down, completion computes bio_completed of the original bio as sum of the bio_completes of the splits. For BIO_SETUP, bio_length means something different than the length. it is the requested speedup amount, and is duplicated into the splits, which is in fact reasonable, since we cannot know how the previous activity was distributed among subordinate geoms. Obviously, the sum of n bio_length is greater than bio_length for n > 1, which triggers assert that bio_length >= bio_completed for e.g. geom_stripe and geom_raid3. Fix this by reassigning bio_completed from bio_length for completed BIO_SPEEDED, I do not think it really mattters what we return in bio_completed. Reported and tested by: pho Reviewed by: imp MFC after: 1 week Differential revision: https://reviews.freebsd.org/D23380 Modified: head/sys/geom/geom_subr.c head/sys/geom/stripe/g_stripe.c Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Mon Jan 27 13:12:40 2020 (r357171) +++ head/sys/geom/geom_subr.c Mon Jan 27 13:15:16 2020 (r357172) @@ -1134,8 +1134,11 @@ g_std_done(struct bio *bp) bp2->bio_completed += bp->bio_completed; g_destroy_bio(bp); bp2->bio_inbed++; - if (bp2->bio_children == bp2->bio_inbed) + if (bp2->bio_children == bp2->bio_inbed) { + if (bp2->bio_cmd == BIO_SPEEDUP) + bp2->bio_completed = bp2->bio_length; g_io_deliver(bp2, bp2->bio_error); + } } /* XXX: maybe this is only g_slice_spoiled */ Modified: head/sys/geom/stripe/g_stripe.c ============================================================================== --- head/sys/geom/stripe/g_stripe.c Mon Jan 27 13:12:40 2020 (r357171) +++ head/sys/geom/stripe/g_stripe.c Mon Jan 27 13:15:16 2020 (r357172) @@ -298,6 +298,8 @@ g_stripe_done(struct bio *bp) mtx_unlock(&sc->sc_lock); if (pbp->bio_driver1 != NULL) uma_zfree(g_stripe_zone, pbp->bio_driver1); + if (bp->bio_cmd == BIO_SPEEDUP) + pbp->bio_completed = pbp->bio_length; g_io_deliver(pbp, pbp->bio_error); } else mtx_unlock(&sc->sc_lock);