Date: Fri, 25 Apr 1997 16:29:51 +0800 (CST) From: gareth@eagle.seed.net.tw To: FreeBSD-gnats-submit@freebsd.org Subject: kern/3381: 2.2.x kernel panic on traversing and removing an NFS mounted directory. Message-ID: <199704250829.QAA01334@g2314a.dorm.ccu.edu.tw> Resent-Message-ID: <199704250840.BAA02565@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Apr 25 01:40:00 PDT 1997 >Last-Modified: >Originator: Gareth Shue >Organization: >Release: FreeBSD 2.2.1-RELEASE i386 >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. >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704250829.QAA01334>