From nobody@FreeBSD.ORG Sat Aug 21 20:11:44 1999
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id 903D2150D5; Sat, 21 Aug 1999 20:11:44 -0700 (PDT)
Message-Id: <19990822031144.903D2150D5@hub.freebsd.org>
Date: Sat, 21 Aug 1999 20:11:44 -0700 (PDT)
From: spam@sporty.org
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@freebsd.org
Subject: can't compile when softupdates + debug.
X-Send-Pr-Version: www-1.0

>Number:         13314
>Category:       kern
>Synopsis:       can't compile when softupdates + debug.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    sheldonh
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Aug 21 20:20:01 PDT 1999
>Closed-Date:    Wed Dec 15 06:29:54 PST 1999
>Last-Modified:  Wed Dec 15 06:30:40 PST 1999
>Originator:     spencer portee
>Release:        3.2-release
>Organization:
sporty.org.. i never give out my real address.. 
>Environment:
FreeBSD ying.sporty.org 3.2-STABLE FreeBSD 3.2-STABLE #6: Thu Jul 29 23:49:32 EDT 1999     root@ying.sporty.org:/usr/src/sys/compile/ying  i386
>Description:
system acting funny.. so tried to define DEBUG to see why its rebooting by itself....

If your config file has 

options SOFTUPDATES 
options "DEBUG=1"

you'll get an error in reallockblk of ffs_alloc.c that ffs_checkblk is nto defined.

it seems that the prototype for the function is #ifdef DIAGNOSTIC, yet in the reallocblk, there is a #ifdef DEBUG..#endif block that uses the ffs_checkblk() function.

in other words, it is defined under the DIAGNOSTIC condition but used in both DIAGNOSTIC and DEBUG.

>How-To-Repeat:
add those two lines above in your options for config'ing a kernel, but exclude  options "DIAGNOSTIC=1"

>Fix:
include options "DIAGNOSTIC=1" to config file so that the function, ffs_checkblk is defined so that the #ifdef DEBUG..endif block that contains the call to the function as the prototype is surrounded by an $ifdef DIAGNOSTIC .. endif block



>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->sheldonh 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Mon Aug 23 08:07:59 PDT 1999 
Responsible-Changed-Why:  
I'll take this one. If it gets hairy, I'll back off. :-) 

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: spencer portee <spam@sporty.org>
Cc: freebsd-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org,
	dyson@iquest.net
Subject: Re: kern/13314: can't compile when softupdates + debug.
Date: Mon, 23 Aug 1999 17:07:37 +0200

 It looks like the problem was introduced in rev 1.28 of ffs_alloc.c .
 I think the patch below is the correct fix to this problem. Please try
 it with
 
 	options		DIAGNOSTIC
 
 instead of
 
 	options		DEBUG
 
 in your kernel config file.
 
 Your feedback would be greatly appreciated.
 
 Thanks,
 Sheldon.
 
 Index: ffs_alloc.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/ufs/ffs/ffs_alloc.c,v
 retrieving revision 1.58
 diff -u -d -r1.58 ffs_alloc.c
 --- ffs_alloc.c	1999/05/12 22:32:07	1.58
 +++ ffs_alloc.c	1999/08/23 14:58:03
 @@ -343,7 +343,7 @@
  static int doreallocblks = 1;
  SYSCTL_INT(_vfs_ffs, FFS_REALLOCBLKS, doreallocblks, CTLFLAG_RW, &doreallocblks, 0, "");
  
 -#ifdef DEBUG
 +#ifdef DIAGNOSTIC
  static volatile int prtrealloc = 0;
  #endif
  
 @@ -447,7 +447,7 @@
  	 * block pointers in the inode and indirect blocks associated
  	 * with the file.
  	 */
 -#ifdef DEBUG
 +#ifdef DIAGNOSTIC
  	if (prtrealloc)
  		printf("realloc: ino %d, lbns %d-%d\n\told:", ip->i_number,
  		    start_lbn, end_lbn);
 @@ -465,7 +465,7 @@
  		if (dbtofsb(fs, buflist->bs_children[i]->b_blkno) != *bap)
  			panic("ffs_reallocblks: alloc mismatch");
  #endif
 -#ifdef DEBUG
 +#ifdef DIAGNOSTIC
  		if (prtrealloc)
  			printf(" %d,", *bap);
  #endif
 @@ -514,7 +514,7 @@
  	/*
  	 * Last, free the old blocks and assign the new blocks to the buffers.
  	 */
 -#ifdef DEBUG
 +#ifdef DIAGNOSTIC
  	if (prtrealloc)
  		printf("\n\tnew:");
  #endif
 @@ -524,7 +524,7 @@
  			    dbtofsb(fs, buflist->bs_children[i]->b_blkno),
  			    fs->fs_bsize);
  		buflist->bs_children[i]->b_blkno = fsbtodb(fs, blkno);
 -#ifdef DEBUG
 +#ifdef DIAGNOSTIC
  		if (!ffs_checkblk(ip,
  		   dbtofsb(fs, buflist->bs_children[i]->b_blkno), fs->fs_bsize))
  			panic("ffs_reallocblks: unallocated block 3");
 @@ -532,7 +532,7 @@
  			printf(" %d,", blkno);
  #endif
  	}
 -#ifdef DEBUG
 +#ifdef DIAGNOSTIC
  	if (prtrealloc) {
  		prtrealloc--;
  		printf("\n");
 

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: spencer portee <spam@sporty.org>,
	freebsd-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org,
	dyson@iquest.net
Cc:  
Subject: Re: kern/13314: can't compile when softupdates + debug. 
Date: Mon, 23 Aug 1999 17:14:56 +0200

 On Mon, 23 Aug 1999 17:07:37 +0200, Sheldon Hearn wrote:
 
 > 	options		DIAGNOSTIC
 > 
 > instead of
 > 
 > 	options		DEBUG
 
 Sorry, got muddled. You can have both in your kernel config if you want.
 
 Ciao,
 Sheldon.
 

From: Spencer Portee <sporty@sporty.org>
To: Sheldon Hearn <sheldonh@uunet.co.za>
Cc: spencer portee <spam@sporty.org>,
	freebsd-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org,
	dyson@iquest.net
Subject: Re: kern/13314: can't compile when softupdates + debug.
Date: Mon, 23 Aug 1999 11:15:49 -0400 (EDT)

 or some odd combination of the two.  thanx for the prompt reply.
 
 On Mon, 23 Aug 1999, Sheldon Hearn wrote:
 
 > 
 > It looks like the problem was introduced in rev 1.28 of ffs_alloc.c .
 > I think the patch below is the correct fix to this problem. Please try
 > it with
 > 
 > 	options		DIAGNOSTIC
 > 
 > instead of
 > 
 > 	options		DEBUG
 > 
 > in your kernel config file.
 > 
 > Your feedback would be greatly appreciated.
 > 
 > Thanks,
 > Sheldon.
 > 
 > Index: ffs_alloc.c
 > ===================================================================
 > RCS file: /home/ncvs/src/sys/ufs/ffs/ffs_alloc.c,v
 > retrieving revision 1.58
 > diff -u -d -r1.58 ffs_alloc.c
 > --- ffs_alloc.c	1999/05/12 22:32:07	1.58
 > +++ ffs_alloc.c	1999/08/23 14:58:03
 > @@ -343,7 +343,7 @@
 >  static int doreallocblks = 1;
 >  SYSCTL_INT(_vfs_ffs, FFS_REALLOCBLKS, doreallocblks, CTLFLAG_RW, &doreallocblks, 0, "");
 >  
 > -#ifdef DEBUG
 > +#ifdef DIAGNOSTIC
 >  static volatile int prtrealloc = 0;
 >  #endif
 >  
 > @@ -447,7 +447,7 @@
 >  	 * block pointers in the inode and indirect blocks associated
 >  	 * with the file.
 >  	 */
 > -#ifdef DEBUG
 > +#ifdef DIAGNOSTIC
 >  	if (prtrealloc)
 >  		printf("realloc: ino %d, lbns %d-%d\n\told:", ip->i_number,
 >  		    start_lbn, end_lbn);
 > @@ -465,7 +465,7 @@
 >  		if (dbtofsb(fs, buflist->bs_children[i]->b_blkno) != *bap)
 >  			panic("ffs_reallocblks: alloc mismatch");
 >  #endif
 > -#ifdef DEBUG
 > +#ifdef DIAGNOSTIC
 >  		if (prtrealloc)
 >  			printf(" %d,", *bap);
 >  #endif
 > @@ -514,7 +514,7 @@
 >  	/*
 >  	 * Last, free the old blocks and assign the new blocks to the buffers.
 >  	 */
 > -#ifdef DEBUG
 > +#ifdef DIAGNOSTIC
 >  	if (prtrealloc)
 >  		printf("\n\tnew:");
 >  #endif
 > @@ -524,7 +524,7 @@
 >  			    dbtofsb(fs, buflist->bs_children[i]->b_blkno),
 >  			    fs->fs_bsize);
 >  		buflist->bs_children[i]->b_blkno = fsbtodb(fs, blkno);
 > -#ifdef DEBUG
 > +#ifdef DIAGNOSTIC
 >  		if (!ffs_checkblk(ip,
 >  		   dbtofsb(fs, buflist->bs_children[i]->b_blkno), fs->fs_bsize))
 >  			panic("ffs_reallocblks: unallocated block 3");
 > @@ -532,7 +532,7 @@
 >  			printf(" %d,", blkno);
 >  #endif
 >  	}
 > -#ifdef DEBUG
 > +#ifdef DIAGNOSTIC
 >  	if (prtrealloc) {
 >  		prtrealloc--;
 >  		printf("\n");
 > 
 
 

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: Bruce Evans <bde@zeta.org.au>
Cc:  
Subject: Re: kern/13314: can't compile when softupdates + debug. 
Date: Mon, 23 Aug 1999 17:53:31 +0200

 On Tue, 24 Aug 1999 01:46:06 +1000, Bruce Evans wrote:
 
 > No, prtrealloc is for debugging, not for diagnostics.
 
 I assumed too much. It's recurring theme that becomes less funny each
 time it comes around.
 
 > The ifdefs fo ffs_chkblk() are wrong.
 
 *nod* Once you pointed out the need for prtrealloc to be conditional on
 DEBUG, the rest kinda became obvious.
 
 Ciao,
 Sheldon.
 
 Index: ffs_alloc.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/ufs/ffs/ffs_alloc.c,v
 retrieving revision 1.58
 diff -u -d -r1.58 ffs_alloc.c
 --- ffs_alloc.c	1999/05/12 22:32:07	1.58
 +++ ffs_alloc.c	1999/08/23 15:50:54
 @@ -524,10 +524,12 @@
  			    dbtofsb(fs, buflist->bs_children[i]->b_blkno),
  			    fs->fs_bsize);
  		buflist->bs_children[i]->b_blkno = fsbtodb(fs, blkno);
 -#ifdef DEBUG
 +#ifdef DIAGNOSTIC
  		if (!ffs_checkblk(ip,
  		   dbtofsb(fs, buflist->bs_children[i]->b_blkno), fs->fs_bsize))
  			panic("ffs_reallocblks: unallocated block 3");
 +#endif
 +#ifdef DEBUG
  		if (prtrealloc)
  			printf(" %d,", blkno);
  #endif
 
State-Changed-From-To: open->analyzed 
State-Changed-By: sheldonh 
State-Changed-When: Tue Aug 24 01:43:57 PDT 1999 
State-Changed-Why:  
Fixed in CURRENT in rev 1.60 .  MFC to follow. 
State-Changed-From-To: analyzed->suspended 
State-Changed-By: sheldonh 
State-Changed-When: Fri Oct 1 05:19:55 PDT 1999 
State-Changed-Why:  
I'm told that suspended is the correct state for issues awaiting an 
MFC. 
State-Changed-From-To: suspended->closed 
State-Changed-By: sheldonh 
State-Changed-When: Wed Dec 15 06:29:54 PST 1999 
State-Changed-Why:  
Merged from CURRENT in rev 1.56.2.2. 
>Unformatted:
