From owner-freebsd-hackers Fri Mar 23 2:22:42 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from relay1.kpn-telecom.nl (relay1.kpn-telecom.nl [145.7.200.6]) by hub.freebsd.org (Postfix) with ESMTP id 6D86637B719 for ; Fri, 23 Mar 2001 02:22:36 -0800 (PST) (envelope-from j.schripsema@kpn.com) Received: from hdiro010.kpn.com (hdiro010.kpn.com [145.7.200.10]) by relay1.kpn-telecom.nl (8.11.1/8.11.1) with SMTP id f2NAMXY01475 for ; Fri, 23 Mar 2001 11:22:34 +0100 Received: from 10.1.88.11 by hdiro010.kpn.com (InterScan E-Mail VirusWall NT); Fri, 23 Mar 2001 11:22:01 +0100 (Romance Standard Time) Received: from tmail001s.telecom.ptt.nl (tmail001s.pc.telecom.ptt.nl [145.7.210.58]) by sat-relay1.pc.telecom.ptt.nl (8.11.1/8.11.1) with ESMTP id f2NALxx10992 for ; Fri, 23 Mar 2001 11:21:59 +0100 Received: by tmail001s with Internet Mail Service (5.5.2448.0) id ; Fri, 23 Mar 2001 11:21:59 +0100 Message-ID: From: j.schripsema@kpn.com To: freebsd-hackers@freebsd.org Subject: NFS: "got bad cookie" error (again?) Date: Fri, 23 Mar 2001 11:21:55 +0100 Importance: high X-Priority: 1 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2448.0) Content-Type: text/plain; charset="iso-8859-1" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hello, Running bonnie++ on a NFS mounted files system doesn't work. Bonnie exits with a fatal error caused by an attempt to remove a non-empty directory. Bonnie tries to remove all files in a directory by calling 'readdir' an 'unlink' in a loop. This works fine on a local filesystem (UFS) but not on a NFS mounted filesystem (also UFS on the server). I'm running FreeBSD 4.2-RELEASE on both the nfs-server and nfs-client. I have used several NFS configs (v2/v3). I have seen references to this problem in old archives (1997, FBSD 2.2.5/6), but it seems the problem has never been fixed. Is this correct? I even read the manual :-( but could not find a solution. Below you will find a small program that reveals the problem, including a fix., which I do not like, because it requires a change in user programs. Regards, Jakob Schripsema sch@kpn.com ------------------------------- #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); } /* This fixes the problem */ rewinddir(dirp); /* End fix */ } } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message