From icon@g2314a.dorm.ccu.edu.tw  Fri Apr 25 01:31:11 1997
Received: from g2314a.dorm.ccu.edu.tw (g2314a.dorm.ccu.edu.tw [140.123.212.144])
          by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id BAA02040
          for <FreeBSD-gnats-submit@freebsd.org>; Fri, 25 Apr 1997 01:31:09 -0700 (PDT)
Received: (from icon@localhost) by g2314a.dorm.ccu.edu.tw (8.8.5/8.7.3) id QAA01334; Fri, 25 Apr 1997 16:29:51 +0800 (CST)
Message-Id: <199704250829.QAA01334@g2314a.dorm.ccu.edu.tw>
Date: Fri, 25 Apr 1997 16:29:51 +0800 (CST)
From: gareth@eagle.seed.net.tw
Reply-To: gareth@eagle.seed.net.tw
To: FreeBSD-gnats-submit@freebsd.org
Subject: 2.2.x kernel panic on traversing and removing an NFS mounted directory.
X-Send-Pr-Version: 3.2

>Number:         3381
>Category:       kern
>Synopsis:       2.2.x kernel panic on traversing and removing an NFS mountd directory
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    peter
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 25 01:40:00 PDT 1997
>Closed-Date:    Wed Mar 28 11:46:04 PST 2001
>Last-Modified:  Wed Mar 28 11:55:11 PST 2001
>Originator:     Gareth Shue
>Release:        FreeBSD 2.2.1-RELEASE i386
>Organization:
>Environment:

        FreeBSD 2.2-RELEASE, 2.2.1-RELEASE, 2.2.STABLE #0.

>Description:

        The enclosed program traverse a directory and removes
	every file. It works fine when
	  (1) on local disk filesystem
	  (2) both on local and nfs mounted filesystem on 2.1.5 RELEASE
        But, the same program causes kernel panic on FreeBSD 2.2.x when
	traversing NFS mounted directories. 
	NFS server => 2.1.5-RELEASE, 2.2-RELEASE, 2.2.1-RELEASE

>How-To-Repeat:

        For repeating this problem, we have to mounted a NFS filesytem
	first. (This test will not affect the NFS server). 
	1. Compile the enclosed program by "gcc -o myrmdir prog.c"
	2. Run it. "myrmdir <nfs-directory>"
	3. kernel panic....rebooting..
------------------->> prog.c cut here<<---------------------------------------
#include <sys/stat.h>
#include <dirent.h>

int RemoveDir(char *dir)
{
   DIR *dirp;
   struct dirent *dp;
   struct stat stbuf;

   chdir(dir);
   if ( (dirp = opendir(".")) == NULL ){
      perror("opendir()");
      exit(-1);
   }
   
   while ( (dp = readdir(dirp)) != NULL ) {

      if ( !strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..") )
         continue;


      if ( stat(dp->d_name, &stbuf) == -1 ) {
         perror("state():");
         continue; 
      }

      if ( S_ISDIR(stbuf.st_mode) ){
         RemoveDir(dp->d_name);
         continue;
      }
      printf("unlink %s\n", dp->d_name);
      unlink(dp->d_name);
   }
   closedir(dirp);
   chdir("..");
   rmdir(dir);
   return 1;
}

int main(int argc, char *argv[])
{

   if ( argc < 2 ) exit(-1);
   RemoveDir(argv[1]);
   return 1;
}
---------------------------->> end here <<------------------------------

>Fix:
    no ideas.	
	
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: joerg 
State-Changed-When: Sun Aug 24 20:30:34 MEST 1997 
State-Changed-Why:  

Feedback request: does it still happen? 


Responsible-Changed-From-To: freebsd-bugs->dfr 
Responsible-Changed-By: joerg 
Responsible-Changed-When: Sun Aug 24 20:30:34 MEST 1997 
Responsible-Changed-Why:  
Doug is Mr. NFS in FreeBSD. 
State-Changed-From-To: closed->open 
State-Changed-By: peter 
State-Changed-When: Sun Apr 26 00:40:20 PDT 1998 
State-Changed-Why:  
This doesn't look like it was resolved, I'll check into it. 


Responsible-Changed-From-To: dfr->peter 
Responsible-Changed-By: peter 
Responsible-Changed-When: Sun Apr 26 00:40:20 PDT 1998 
Responsible-Changed-Why:  
I'll look into it. 
State-Changed-From-To: open->closed 
State-Changed-By: iedowse 
State-Changed-When: Wed Mar 28 11:46:04 PST 2001 
State-Changed-Why:  
Feedback timeout (joerg asked for feedback in Aug 1997, and there 
is no further record of any reply in the archives). Also, I have 
not heard of this recently, so I suspect it is fixed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=3381 
>Unformatted:
