From owner-freebsd-fs@FreeBSD.ORG Fri May 9 19:02:40 2003 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 32D9537B401; Fri, 9 May 2003 19:02:40 -0700 (PDT) Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by mx1.FreeBSD.org (Postfix) with SMTP id 69F8F43F85; Fri, 9 May 2003 19:02:38 -0700 (PDT) (envelope-from iedowse@maths.tcd.ie) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 10 May 2003 03:02:37 +0100 (BST) To: Juli Mallett In-Reply-To: Your message of "Fri, 09 May 2003 20:32:29 CDT." <20030509203228.A62797@FreeBSD.org> Date: Sat, 10 May 2003 03:02:37 +0100 From: Ian Dowse Message-ID: <200305100302.aa28788@salmon.maths.tcd.ie> cc: freebsd-fs@FreeBSD.org cc: Poul-Henning Kamp cc: Lukas Ertl Subject: Re: newfs: useless/bogus check if new last block can be accessed? X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 May 2003 02:02:40 -0000 In message <20030509203228.A62797@FreeBSD.org>, Juli Mallett writes: >I at one point had some warnx calls (at minimum, since things tend to work >and it's better to let someone shoot their foot maybe than use errx, cause >at that point, it's a bit late.) and so on. I didn't ever get them into >CVS as I was working on general libufs-ification at the time of newfs, and >then tracking down why that broke things (*blush*), and I didn't want to >put in too many new failure cases I could be blamed for :) Do a bunch of The missing error checking appears to be a regression introduced in revision 1.71 of mkfs.c; before that, any write failures in wtfs() would cause newfs to output the sector number, the errno string and then exit. >(which went nowhere due to over-engineering, and too much faith...er, yeah, >it went nowhere), one of the things I wanted to do was have a "naive" flag >as part of an (undeveloped) generalised flags (external, not like MINE_) >interface, which would let libufs do the exploding, if things went wrong. Something like the patch below should do the trick for now. This puts back the old exit code and sector number information, but relies on the undocumented (?) behaviour of bwrite() leaving a sensible value in errno. Ian Index: mkfs.c =================================================================== RCS file: /dump/FreeBSD-CVS/src/sbin/newfs/mkfs.c,v retrieving revision 1.75 diff -u -r1.75 mkfs.c --- mkfs.c 3 May 2003 18:41:58 -0000 1.75 +++ mkfs.c 10 May 2003 01:56:39 -0000 @@ -849,7 +849,8 @@ { if (Nflag) return; - bwrite(&disk, bno, bf, size); + if (bwrite(&disk, bno, bf, size) < 0) + err(36, "wtfs: %d bytes at sector %jd", size, (intmax_t)bno); } /*