From owner-freebsd-current@FreeBSD.ORG Mon Dec 9 07:04:04 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8F7FF365 for ; Mon, 9 Dec 2013 07:04:04 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 20DA419EB for ; Mon, 9 Dec 2013 07:04:03 +0000 (UTC) Received: from ASUS ([84.227.120.88]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0Ld0fQ-1V81Td3JYm-00iByF for ; Mon, 09 Dec 2013 08:04:02 +0100 From: "Stefan Hegnauer" To: "'Konstantin Belousov'" References: <52a4ad05.892ee50a.41cd.084aSMTPIN_ADDED_BROKEN@mx.google.com> <20131209044239.GS59496@kib.kiev.ua> In-Reply-To: <20131209044239.GS59496@kib.kiev.ua> Subject: RE: nanobsd / dd problem? Date: Mon, 9 Dec 2013 08:04:01 +0100 Message-ID: <000b01cef4ac$d717b350$854719f0$@hegnauer@gmx.ch> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac70mRuR8vOYA/lSTh27sKiiCcQd4wAExiSw Content-Language: de-ch X-Provags-ID: V03:K0:kCuxzFU2nd2lskK7WAVM5d1l5LlK3n+K8Ov8H4xHgpZ1F/cWDMc ASWtPx5Cw4LLopkTDezg1EGrqygVe6NTeP258mQ+cp74pgR7LjywikgfYmHhl5ZR/cZxNPU ZiKtnhT0D9xDXaN8SaPb2aAgwBpXUAng0QzjbDKVewPNHNDfM3SnWVrcjbesxCqQdPjW0MB ekh85Dh/GA8PXvZN9MWIQ== Cc: mav@freebsd.org, freebsd-current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Dec 2013 07:04:04 -0000 On Monday, December 09, 2013 at 5:43 AM Konstantin Belousov wrote: > On Sun, Dec 08, 2013 at 06:31:36PM +0100, Stefan Hegnauer wrote: > > Hi, > > > > > > > > I am using freebsd-current (FreeBSD BUILDMASTER 11.0-CURRENT FreeBSD > > 11.0-CURRENT #0 r259095: Sun Dec 8 10:20:40 CET 2013 > > root@BUILDMASTER:/usr/obj/usr/src/sys/ASUS i386) in a VirtualBox as > a build > > machine for nanobsd images to be used on pc-engines.ch alix boards. > The only > > difference to GENERIC is the inclusion of 'march=geode' and disabling > of > > most debugging switches (malloc, Witness etc). Worked like a charm in > the > > past. > > > > > > > > Since late summer - sorry, no exact date / svn revision - nanobsd.sh > fails > > at the last stage when building the disk image, e.g. with > > > > ... > > > > 00:00:25 ### log: /usr/obj/nanobsd.alixpf//_.di > > > > # > > > > > > > > Looking a bit closer it seems that dd(1) returns with an I/O error > whenever > > the input is a file created with mdconfig(8): > > > > # dd if=/dev/zero of=somebackingfile bs=1k count=5k > > > > # mdconfig -f somebackingfile -u md0 > > > > # newfs -U /dev/md0 > > > > # dd if=/dev/md0 of=/dev/null > > > > dd: /dev/md0: Input/output error > > > > 10241+0 records in > > > > 10241+0 records out > > > > 5243392 bytes transferred in 3.240345 secs (1618159 bytes/sec) > > > > > > > > The outputfile in nanobsd.sh seems to be error-free. > It should be one block larger than the right size. > \ > > > > Anyone else seen similar behaviour? How to proceed/fix it? > > > > The following patch should clear the error. > > The issue is that kern_physio() incorrectly detects EOF due to > incorrect > calculation of bio bio_resid after the bio_length was clipped by the > 'excess' code in g_io_check(). Both bio_length and bio_resid appear > to be 0 in the pre-last dd transfer, which starts exactly and the > mediasize, and kern_physio() thinks that it transferred one more block > than was transferred. > > I _suspect_ that it was caused by 'excess' code moving in r256880, > but I am really not in the right condition to analyze it. If somebody > could try the same dd experiment to confirm or deny my suspicion, it > would be useful. > > The patch below should be a right thing to do anyway. > > diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c > index c23a74b..b7c4d60 100644 > --- a/sys/kern/vfs_bio.c > +++ b/sys/kern/vfs_bio.c > @@ -3679,7 +3679,6 @@ bufdonebio(struct bio *bip) > > bp = bip->bio_caller2; > bp->b_resid = bp->b_bcount - bip->bio_completed; > - bp->b_resid = bip->bio_resid; /* XXX: remove */ > bp->b_ioflags = bip->bio_flags; > bp->b_error = bip->bio_error; > if (bp->b_error) Works for me - please commit! Thanks a lot! -Stefan