Date: Mon, 16 Nov 1998 18:52:56 -0600 (CST) From: Mohit Aron <aron@cs.rice.edu> To: freebsd-hackers@FreeBSD.ORG Subject: problems with NFS/VM Message-ID: <199811170052.SAA04707@elf.cs.rice.edu>
next in thread | raw e-mail | index | archive | help
Hi, I'm using FreeBSD-2.2.6. I'm observing some strange behavior with user applications accessing an NFS filesystem (NFS server is also a FreeBSD-2.2.6 machine). Apparently the problems arise once the VM object cache gets full (variable vm_object_cached becomes equal to vm_object_cache_max) and the application is making heavy access to the filesystem. There are two problems: 1) The stat() system call can return incorrect data. Sometimes something like: stat("/usr/users/foo", ...) returns a file size in the stat struct that is incorrect. However the following sequence fixes the problem with the stat command: fd = open("/usr/users/foo", O_RDONLY, 0); stat("/usr/users/foo", ...); Once the file is open for reading, the stat command always returns the correct data. I assume the root of the problem is somewhere in the NFS code that doesn't lock some structure accessed by stat() while the corresponding vnode is being freed. 2) Even when the stat() problem above is fixed, accessing the file through an mmap'd region can return incorrect data. A sequence like: fd = open("/usr/users/foo", O_RDONLY, 0); stat("/usr/users/foo", &info); /* size contained in info.st_size */ addr = mmap(fd, ...); close(fd); write(clientsock, addr, info.st_size) The above sequence sometimes causes data to be written to clientsock that is completely incorrect - it seems to come from other files in the NFS mounted filesystem (despite the fact that stat reports the correct size of the file). Also the data written to clientsock can sometimes be less than the size reported in info.st_size. To observe the problems quickly you can set the 'vm_object_cache_max' variable to a small number and then run the Apache 1.3.3 webserver that serves files from an NFS mounted directory. The clients should be such that they generate appreciable load on the webserver. The clients should be aware of the data that they can expect to get. Please note that the above problems are probably a result of race conditions in the kernel and you only observe them once in a while. I'm not familiar with the NFS code in FreeBSD and I'll appreciate any pointers to fix the above problems. I've already tried using FreeBSD-2.2-stable and the problems are still there. - Mohit Aron aron@cs.rice.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811170052.SAA04707>