From owner-freebsd-bugs Fri Jan 24 18:00:05 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id SAA09902 for bugs-outgoing; Fri, 24 Jan 1997 18:00:05 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id SAA09892; Fri, 24 Jan 1997 18:00:03 -0800 (PST) Resent-Date: Fri, 24 Jan 1997 18:00:03 -0800 (PST) Resent-Message-Id: <199701250200.SAA09892@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, Received:(from nobody@localhost) by.freefall.freebsd.org.id.RAA09644;Fri; (8.8.5/8.8.5);, 24 Jan 1997 17:57:03.-0800 (PST) Message-Id: <199701250157.RAA09644@freefall.freebsd.org> Date: Fri, 24 Jan 1997 17:57:03 -0800 (PST) From: dunc@netcom.com To: freebsd-gnats-submit@freebsd.org X-Send-Pr-Version: www-1.0 Subject: kern/2573: mmap on nfs mounted file hangs system Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >Number: 2573 >Category: kern >Synopsis: mmap on nfs mounted file hangs system >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jan 24 18:00:01 PST 1997 >Last-Modified: >Originator: Kevet Duncombe >Organization: Filoli Information Systems >Release: FreeBSD 2.1.5-RELEASE >Environment: FreeBSD falcon.filoli.com 2.1.5-RELEASE FreeBSD 2.1.5-RELEASE #2: Mon Jan 13 17:05:44 PST 1997 >Description: I create a file, mmap it, then use that as the buffer for a read; when the read is done, I msync, munmap, and have my bytes copied to disk. If I create the file on a local disk, it runs fine and a cat of the file shows all the expected data. When I create it in my nfs mounted home directory, though, the system locks up. Since I don't have X installed I mostly work via rsh from a Next box nearby. All those rsh sessions freeze; so does the top left running on the console. Attempts to rsh or telnet to it connect but immediately hang. Ping works, and Alt-F? switches among the virtual consoles, but those are the only signs of life as far as I can see. Reset is the only escape I've found. I stripped the code to a short example. For what it's worth, I also tried it on a Sun and had no problem, so I'm pretty sure it is the FreeBSD end and not the server end that's acting up. >How-To-Repeat: 1) compile the following program 2) run it to create file "deleteme" 3) cat deleteme #include #include #include #include #include #include #include #ifdef __FreeBSD__ #include #else void err(int ret,char *msg) { fprintf(stderr,"%s: %s\n",msg,strerror(errno)); exit(ret); } #endif void main() { char *filebuf; char zero = 0; int filelen = 603; /* not magic as far as I know */ int src = open("/dev/zero",O_RDONLY); int dst = open("deleteme",O_CREAT|O_TRUNC|O_RDWR,0644); if (src == -1) err(1,"can't open input file"); if (dst == -1) err(1,"can't open output file"); if (lseek(dst,filelen-1,SEEK_SET) == -1) err(1,"can't seek output file to filelen"); if (write(dst,&zero,1) != 1) err(1,"can't extend output file to filelen"); filebuf = mmap(0,filelen,PROT_READ|PROT_WRITE,MAP_SHARED,dst,0); if ((long)filebuf == -1) err(1,"can't mmap file"); /* if (close(dst) == -1) err(1,"can't close output file"); */ if (read(src,filebuf,filelen) != filelen) err(1,"error reading file from jukeomatic"); if (msync((caddr_t)filebuf,filelen,0) == -1) err(1,"can't msync mmap'd output file"); if (munmap((caddr_t)filebuf,filelen) == -1) err(1,"can't munmap mmap'd output file"); } >Fix: >Audit-Trail: >Unformatted: