From owner-freebsd-bugs Tue Mar 27 2:30:21 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 5520B37B71B for ; Tue, 27 Mar 2001 02:30:04 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f2RAU4024647; Tue, 27 Mar 2001 02:30:04 -0800 (PST) (envelope-from gnats) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id C32FE37B719 for ; Tue, 27 Mar 2001 02:29:07 -0800 (PST) (envelope-from nobody@FreeBSD.org) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f2RAIr213382; Tue, 27 Mar 2001 02:18:53 -0800 (PST) (envelope-from nobody) Message-Id: <200103271018.f2RAIr213382@freefall.freebsd.org> Date: Tue, 27 Mar 2001 02:18:53 -0800 (PST) From: j.schripsema@kpn.com To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: kern/26142: Unlink fails on NFS mounted filesystem Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 26142 >Category: kern >Synopsis: Unlink fails on NFS mounted filesystem >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Mar 27 02:30:04 PST 2001 >Closed-Date: >Last-Modified: >Originator: Jakob Schripsema >Release: 4.2-RELEASE >Organization: KPN >Environment: client: FreeBSD nfsclient 4.2-RELEASE FreeBSD 4.2-RELEASE #0: Mon Nov 20 13:02:55 GMT 2000 jkh@bento.FreeBSD.org:/usr/src/sys/compile/GENERIC i386 server: FreeBSD nfsserver 4.2-RELEASE FreeBSD 4.2-RELEASE #0: Mon Nov 20 13:02:55 GMT 2000 jkh@bento.FreeBSD.org:/usr/src/sys/compile/GENERIC i386 >Description: When removing all files in a large NFS mounted directory by calling readdir and unlink repeatedly files get skipped. It seems that this problem is related to problem kern/3381. I ran into this problem when running bonnie++ (www.cooker.com.au/bonnie++) on a NFS mounted filesystem. >How-To-Repeat: Run the attached program on the client. Uncomment the rewinddir call first. ---- snip ----- #include #include #include #include #define BASEDIR "/FS/testdir" /* NFS mounted */ #define NFILES 1024 main() { create_files(); delete_files(); } create_files() { int i,fd; char buf[2048]; for(i = 0 ; i < NFILES ; i++) { snprintf(buf,2048,"%s/%04d",BASEDIR,i); if ((fd = open(buf,O_CREAT | O_TRUNC | O_WRONLY, 0644)) < 0) { perror(buf); return(-1); } close(fd); } } delete_files() { DIR *dirp; struct dirent *dp; char buf[2048]; if ((dirp = opendir(BASEDIR)) == NULL) { perror("opendir"); return (-1); } while ((dp = readdir(dirp)) != NULL) { if (dp->d_name[0] == '.') continue; snprintf(buf,2048,"%s/%s",BASEDIR,dp->d_name); fprintf(stderr,"%s\n",buf); if (unlink(buf) < 0) { perror(buf); return (-1); } /* Workaround */ /* rewinddir(dirp); */ /* End workaround */ } } >Fix: Call rewinddir after each unlink call. I consider this a workaround, not a fix. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message