From owner-cvs-all@FreeBSD.ORG Mon Oct 1 10:45:33 2007 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5688016A418; Mon, 1 Oct 2007 10:45:33 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id D7FCF13C457; Mon, 1 Oct 2007 10:45:32 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c220-239-235-248.carlnfd3.nsw.optusnet.com.au [220.239.235.248]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id l91AjSBP006034 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 1 Oct 2007 20:45:29 +1000 Date: Mon, 1 Oct 2007 20:45:27 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: "Bjoern A. Zeeb" In-Reply-To: <20071001090547.H85753@maildrop.int.zabbadoz.net> Message-ID: <20071001201359.M2557@besplex.bde.org> References: <200709241339.l8ODd6k6059694@repoman.freebsd.org> <47002674.8050707@tomjudge.com> <47002E2F.3030306@tomjudge.com> <20071001090547.H85753@maildrop.int.zabbadoz.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Tom Judge , cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/ufs/ffs ffs_alloc.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Oct 2007 10:45:33 -0000 On Mon, 1 Oct 2007, Bjoern A. Zeeb wrote: > On Mon, 1 Oct 2007, Tom Judge wrote: > >> Tom Judge wrote: >>> Bjoern A. Zeeb wrote: >>>> bz 2007-09-24 13:39:06 UTC >>>> >>>> FreeBSD src repository >>>> >>>> Modified files: (Branch: RELENG_6) >>>> sys/ufs/ffs ffs_alloc.c Log: >>>> MFC rev. 1.147 >>>> Fix a DIV0 in case a large value for fs_avgfilesize or fs_avgfpdir >>>> is given (with newfs or tunefs) and dirsize overflows. >>>> In case dirsize is <= 0 because of an overflow set maxcontigdirs >>>> to 0 so it will be 1 later. This is what would happen for large >>>> fs_avgfilesize. [1] >>>> Submitted by: pjd [1] >>>> Revision Changes Path >>>> 1.132.2.7 +4 -1 src/sys/ufs/ffs/ffs_alloc.c >>> >>> >>> Does this by any chance fis this PR: kern/111352? >> >> s/fis/fix/ > > yes it should. I closed the PR, See the comment there. s/fix/work around/ The bug is in newfs and tunefs permitting garbage parameters, so it cannot be fixed in ffs_alloc.c. It can also be worked around better in ffs_vfsops.c: fix the garbage parameters at mount time, instead of letting them cause undefined behaviour on every directory allocation later and recovering from the overflow in some cases. ffs_vfsops.c already adjusts the parameters for file systems created by old versions of newfs which don't support them. Then they have the garbage value 0, while versions of newfs and tunefs that support them enforce them being > 0. Enforcing them being <= a maximum value belongs mext to the code that enforces them being > 0, and fixing up garbage large values belongs next to the code that fixes up garbage values of <= 0. Fixups belong in fsck_ffs too, but fsck_ffs doesn't even reference the 5-yar old avgfpdir and avgfilesize parameters. History shows that fixups at mount time take a long time to get moved to fsck_ffs. It's just easier to do runtime fixups. Fixups at mount time used to be marked with /* XXX [move to fsck] */, but now there are many more of them than there used to be, and most aren't marked. Bruce