From owner-freebsd-current Mon Feb 4 8: 3:43 2002 Delivered-To: freebsd-current@freebsd.org Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by hub.freebsd.org (Postfix) with ESMTP id 513B937B41C; Mon, 4 Feb 2002 08:03:36 -0800 (PST) Received: by elvis.mu.org (Postfix, from userid 1192) id 1A3C310DDF9; Mon, 4 Feb 2002 08:03:36 -0800 (PST) Date: Mon, 4 Feb 2002 08:03:36 -0800 From: Alfred Perlstein To: Bruce Evans Cc: John Polstra , current@FreeBSD.ORG, markm@FreeBSD.ORG Subject: Re: Panics in ffs_clusteracct with todays -current Message-ID: <20020204080336.A95852@elvis.mu.org> References: <20020205000829.A22758-100000@gamplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20020205000829.A22758-100000@gamplex.bde.org>; from bde@zeta.org.au on Tue, Feb 05, 2002 at 12:28:43AM +1100 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG * Bruce Evans [020204 05:26] wrote: > On Sun, 3 Feb 2002, John Polstra wrote: > > > The kernel from today's current (CVSupped 3 Feb 2002 around 17:40 > > PST) can't stay up for more than a few minutes without getting a > > page-not-present panic at line 1815 of ufs/ffs/ffs_alloc.c revision > > 1.86. It is in this code: > > > > /* > > * Find the size of the cluster going backward. > > */ > > start = blkno - 1; > > end = start - fs->fs_contigsumsize; > > if (end < 0) > > end = -1; > > mapp = &freemapp[start / NBBY]; > > map = *mapp--; > > ^^^^^ > > BANG! > > This was broken by a recent change to the type of NBBY. > > `start' is apparently negative (it would be for blkno == 0). Small > negative values of `start' used to give an index of 0 in freemapp (not > even small negative, since integer division bogusly rounds negative > values towards 0). They now give an index of about 0x1fffffff on > 32-bit machines. > > I also got panics in vm. The vm code apparently trapped while trying > to map the preposterous address generated by the above. > > This patch just backs out the change to NBBY. Wouldn't this make more sense: Index: ffs/ffs_alloc.c =================================================================== RCS file: /home/ncvs/src/sys/ufs/ffs/ffs_alloc.c,v retrieving revision 1.86 diff -u -r1.86 ffs_alloc.c --- ffs/ffs_alloc.c 2 Feb 2002 01:42:44 -0000 1.86 +++ ffs/ffs_alloc.c 4 Feb 2002 16:08:34 -0000 @@ -1790,7 +1790,7 @@ end = start + fs->fs_contigsumsize; if (end >= cgp->cg_nclusterblks) end = cgp->cg_nclusterblks; - mapp = &freemapp[start / NBBY]; + mapp = &freemapp[start < 0 ? 0 : start / NBBY]; map = *mapp++; bit = 1 << (start % NBBY); for (i = start; i < end; i++) { To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message