From owner-freebsd-current@FreeBSD.ORG Tue Jan 13 15:58:58 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A1E9716A4CE for ; Tue, 13 Jan 2004 15:58:58 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9079B43D4C for ; Tue, 13 Jan 2004 15:58:49 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3p2/8.8.7) with ESMTP id KAA12005; Wed, 14 Jan 2004 10:58:35 +1100 Date: Wed, 14 Jan 2004 10:58:35 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Nate Lawson In-Reply-To: <20040113143823.S63442@root.org> Message-ID: <20040114101757.M3440@gamplex.bde.org> References: <20040113143823.S63442@root.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: current@freebsd.org Subject: Re: fun with df.. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 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: Tue, 13 Jan 2004 23:58:58 -0000 On Tue, 13 Jan 2004, Nate Lawson wrote: > On Mon, 12 Jan 2004, Wilko Bulte wrote: > > My laptop just presented me with a funny one: > > > > wkb@chuck ~: df > > Filesystem 1M-blocks Used Avail Capacity Mounted on > > /dev/ad0s2g 4032 3842 36028797018963835 104% /usr > > /dev/ad0s2e 62 6 51 12% /var > > > > .... > > > > wkb@chuck ~: df -k > > Filesystem 1K-blocks Used Avail Capacity Mounted on > > /dev/ad0s2g 4129310 3934638 -135672 104% /usr > > > > Oldish 5.x- (Dec 17) > > Note the M/K flags. Someone is probably using an unsigned for the M > printing and a (correct) signed for the K printing. I note that there is no -m flag. The 1M blocks apparently come from statfs(), but that shouldn't happen. If this is for an nfs file system, then there are many bugs in this area that could produce output like the above. See PR 56606 and wrong fixes for earlier bug reports in nfs_vfsops.c revs 1.133 and 1.135. The 64-bit statfs changes should have made the bug in nfs moot, but it is missing removal of bogus casts and revs 1.133 and 1.135. A non-broken version of revs 1.133 and 1.135 is needed in cvtstatfs() (not in nfs) to fudge the block size so that large block counts can be represented (cvtstatfs() currrently uses truncation where nfs used overflow, except for large negative block counts cvstatfs() also uses overflow). The 64-bit statfs changes also implemented lots of sign extension bugs. One of them is probably responsible for the large positive block count. The magic number 36028797018963835 is approximately 2^64/512. Bruce