From owner-freebsd-fs@FreeBSD.ORG Sat May 10 06:09:32 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 11FFA37B401; Sat, 10 May 2003 06:09:32 -0700 (PDT) Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by mx1.FreeBSD.org (Postfix) with SMTP id 9AC3243F85; Sat, 10 May 2003 06:09:30 -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 14:09:29 +0100 (BST) To: Juli Mallett In-Reply-To: Your message of "Fri, 09 May 2003 22:39:31 CDT." <20030509223931.A75707@FreeBSD.org> Date: Sat, 10 May 2003 14:09:29 +0100 From: Ian Dowse Message-ID: <200305101409.aa30329@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 13:09:32 -0000 In message <20030509223931.A75707@FreeBSD.org>, Juli Mallett writes: >* Ian Dowse [ Date: 2003-05-09 ] >> 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. > >That looks pretty sane. And bwrite is undocumented. All contracts >are explicit for now. Once it's documented that changes. Actually, the patch isn't quite right, as errno won't be set if there was a short write instead of an error. Unfortunately, there is no way to fix this without changing the libufs API, since bwrite() maps short writes to a -1 return value, so the caller can't tell whether errno is valid. I think bwrite() either needs to have the same semantics as pwrite(2), or else libufs should have the ability to display or return an error message. To avoid loss of previous functionality, the error message would need to at least include the errno string, so the string currently written to d_error is not sufficient. What is using libufs's bwrite()? Would it be better to just make errors fatal for now so that a useful diagnostic can be printed? Ian