Subject: bug in NFS_V2_ONLY option
To: None <firstname.lastname@example.org>
From: Christian Groessler <email@example.com>
Date: 04/21/2001 02:23:09
um, this took me some time to track down...
My /usr/src directory is sym-linked to a nfs directory.
I noticed that my old 486/66 32MB was reliably aborting a "make depend
&& make" of the kernel.
After the make depend was done, make stopped with "make: Result too
Then typing "make" again in this shell or "/bin/pwd" gave the same
error: Result too large.
Fiddling with ulimit etc. didn't help.
I found out the getcwd() call returned with ERANGE.
After looking into sys/kern/vfs_getcwd.c I noticed that the getcwd
system call works 2 way: First it looks into a cache to find the cwd
and if this fails it tries to go up the dir hierarchy to get the cwd
(the traditional way).
Assuming the cache got thrashed with "make depend" I modified
vfs_getcwd() to ignore the cache, this way:
diff -u -r1.14 vfs_getcwd.c
--- vfs_getcwd.c 2000/12/15 11:52:14 1.14
+++ vfs_getcwd.c 2001/04/21 00:07:48
@@ -468,8 +468,8 @@
* Look in the name cache; if that fails, look in the
- error = getcwd_getcache(&lvp, &uvp, &bp, bufp);
- if (error == -1)
+ /*error = getcwd_getcache(&lvp, &uvp, &bp, bufp);
+ if (error == -1)*/
error = getcwd_scandir(&lvp, &uvp, &bp, bufp, p);
I'm not familiar with the kernel code, so this might be a big
nonsense. But after this change getcwd() didn't work if invoked on a
nfs mounted directory. (try /bin/pwd)
I put in some debug messages and the cwd which gets generated goes up
until it should switch from the nfs volume to the local disk, but it
then continues to fill in "./" instead of jumping to the local dir.
Finally the buffer overflows with the "./"s and ERANGE is returned.
I have another i386 machine where this didn't happen, and comparing
their CONFIGs (and trying many combinations) I deduced this only
happens with NFS_V2_ONLY enabled (also on other archs e.g. macppc).
Please fix! :-)