From owner-svn-src-all@freebsd.org Mon Dec 24 02:53:51 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 933DC1353D44; Mon, 24 Dec 2018 02:53:51 +0000 (UTC) (envelope-from ota@j.email.ne.jp) Received: from mail01.asahi-net.or.jp (mail01.asahi-net.or.jp [202.224.55.13]) by mx1.freebsd.org (Postfix) with ESMTP id 595C06B980; Mon, 24 Dec 2018 02:53:49 +0000 (UTC) (envelope-from ota@j.email.ne.jp) Received: from rv515.advok.com (pool-72-76-119-135.nwrknj.fios.verizon.net [72.76.119.135]) (Authenticated sender: NR2Y-OOT) by mail01.asahi-net.or.jp (Postfix) with ESMTPSA id 30C21100B12; Mon, 24 Dec 2018 11:53:37 +0900 (JST) Date: Sun, 23 Dec 2018 21:53:33 -0500 From: Yoshihiro Ota To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r342375 - head/sys/dev/md Message-Id: <20181223215333.5b0065776ba8cc162f0f7799@j.email.ne.jp> In-Reply-To: <201812222259.wBMMxB1c053909@repo.freebsd.org> References: <201812222259.wBMMxB1c053909@repo.freebsd.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; i386-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 595C06B980 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of ota@j.email.ne.jp designates 202.224.55.13 as permitted sender) smtp.mailfrom=ota@j.email.ne.jp X-Spamd-Result: default: False [0.60 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:202.224.55.0/24]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[email.ne.jp]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.13)[-0.127,0]; NEURAL_SPAM_MEDIUM(0.41)[0.412,0]; IP_SCORE(-0.02)[country: JP(-0.09)]; NEURAL_SPAM_SHORT(0.14)[0.142,0]; MX_GOOD(-0.01)[cached: sbmx.asahi-net.or.jp]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[13.55.224.202.list.dnswl.org : 127.0.5.1]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:4685, ipnet:202.224.32.0/19, country:JP]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[135.119.76.72.zen.spamhaus.org : 127.0.0.10] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 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: Mon, 24 Dec 2018 02:53:51 -0000 Thanks. I noticed when this was broken upon a new release long time ago but couldn't get any clue nor when this was broken (since I hadn't started following trunk/stable back then.) Was that 7.0-RELEASE or 8.0-RELEASE....? Anyway, good news and I will try to bring this to local 12.0-RELEASE. Regards, Hiro On Sat, 22 Dec 2018 22:59:11 +0000 (UTC) Bruce Evans wrote: > Author: bde > Date: Sat Dec 22 22:59:11 2018 > New Revision: 342375 > URL: https://svnweb.freebsd.org/changeset/base/342375 > > Log: > Fix devstat on md devices, second attempt. r341765 depends on > g_io_deliver() finishing initialization of the bio, but g_io_deliver() > actually destroys the bio. INVARIANTS makes the bug obvious by > overwriting the bio with garbage. > > Restore the old order for calling devstat (except don't restore not calling > it for the error case), and translate to the devstat KPI so that this order > works. > > Reviewed by: kib > > Modified: > head/sys/dev/md/md.c > > Modified: head/sys/dev/md/md.c > ============================================================================== > --- head/sys/dev/md/md.c Sat Dec 22 21:49:25 2018 (r342374) > +++ head/sys/dev/md/md.c Sat Dec 22 22:59:11 2018 (r342375) > @@ -1241,12 +1241,22 @@ md_kthread(void *arg) > error = sc->start(sc, bp); > } > > + if (bp->bio_cmd == BIO_READ || bp->bio_cmd == BIO_WRITE) { > + /* > + * Devstat uses (bio_bcount, bio_resid) for > + * determining the length of the completed part of > + * the i/o. g_io_deliver() will translate from > + * bio_completed to that, but it also destroys the > + * bio so we must do our own translation. > + */ > + bp->bio_bcount = bp->bio_length; > + bp->bio_resid = (error == -1 ? bp->bio_bcount : 0); > + devstat_end_transaction_bio(sc->devstat, bp); > + } > if (error != -1) { > bp->bio_completed = bp->bio_length; > g_io_deliver(bp, error); > } > - if (bp->bio_cmd == BIO_READ || bp->bio_cmd == BIO_WRITE) > - devstat_end_transaction_bio(sc->devstat, bp); > } > } > > _______________________________________________ > svn-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"