nfs bug & df: Can I lock up my kernel and overflow this buffer?

Billy Newsom smartweb at leadhill.net
Mon May 9 21:14:49 PDT 2005


Here's something pretty stupid about either the code in mount, df, or 
both.  I'm on the verge of a denial of service if this lasts much 
longer.  When I mount an nfs device more than once, I get this 
ridiculous output from df and mount:

#df
Filesystem  1K-blocks    Used   Avail Capacity  Mounted on
/dev/ad0s1a    253678  137554   95830    59%    /
devfs               1       1       0   100%    /dev
/dev/ad0s1e    253678      18  233366     0%    /tmp
/dev/ad0s1f   7782878 3273986 3886262    46%    /usr
/dev/ad0s1d    253678  125386  107998    54%    /var
devfs               1       1       0   100%    /var/named/dev
dell:/nfs     8883912 4104516 4779396    46%    /dellbak
dell:/nfs     8883912 4104516 4779396    46%    /dellbak
dell:/nfs     8883912 4104516 4779396    46%    /dellbak
dell:/nfs     8883912 4104516 4779396    46%    /dellbak
dell:/nfs     8883912 4104516 4779396    46%    /dellbak
dell:/nfs     8883912 4104516 4779396    46%    /dellbak

#mount
/dev/ad0s1a on / (ufs, NFS exported, local)
devfs on /dev (devfs, local)
/dev/ad0s1e on /tmp (ufs, local, soft-updates)
/dev/ad0s1f on /usr (ufs, NFS exported, local, soft-updates)
/dev/ad0s1d on /var (ufs, NFS exported, local)
devfs on /var/named/dev (devfs, local)
dell:/nfs on /dellbak (nfs)
dell:/nfs on /dellbak (nfs)
dell:/nfs on /dellbak (nfs)
dell:/nfs on /dellbak (nfs)
dell:/nfs on /dellbak (nfs)
dell:/nfs on /dellbak (nfs)

Ha, ha!  How many times will this last line repeat itself?  I'm curious 
to see if I can get it to give me a screenful of data.  Will this 
eventually crash the kernel or fill some buffer up?  All I'm doing is 
mounting the same nfs drive over and over.  Normally, mounting a device 
twice will just give a "device busy" or something.  Is there some sanity 
check missing that will prevent mount_nfs from actually mounting the 
same resource at the same mount point over and over?

Details:
* FreeBSD 5.3.  Updated and compiled in mid-February.  I froze it there 
and may soon upgrade to 5.4, but I don't count on this fixing this issue.

* I needed to make sure I had an nfs drive mounted properly, even after 
a reboot, but didn't want to (couldn't?) put it in fstab.  So cron has 
this particular line(s).

44 10 * * * /sbin/mount_nfs -s -x 2 -T dell:/nfs /dellbak

* I am connecting to a local net NFS server running Windows 2000 and 
Services for UNIX 3.5.  Due to some major problems with rebooting and 
NFS, I determined that I needed some of the special commands (-s -x 2) 
to enable the server to reboot.

* I put the mount_nfs command in cron and in an rc.d startup script 
because I didn't see a way to put all of the options in fstab, nor did I 
particularly enjoy booting the FreeBSD server without connecting to the 
NFS drive.... I would fill up my root directory pretty fast.

* Look at the fsid for /dellbak below, using verbose output.  Pretty odd.

# mount -v
/dev/ad0s1a on / (ufs, NFS exported, local, writes: sync 165 async 
29170, reads: sync 2308 async 45, fsid f044aa41725bf386)
devfs on /dev (devfs, local, fsid 01ff000404000000)
/dev/ad0s1e on /tmp (ufs, local, soft-updates, writes: sync 9 async 
4002, reads: sync 125 async 0, fsid f144aa411e8f31da)
/dev/ad0s1f on /usr (ufs, NFS exported, local, soft-updates, writes: 
sync 420 async 129755, reads: sync 170752 async 1401, fsid f144aa4134661c3c)
/dev/ad0s1d on /var (ufs, NFS exported, local, writes: sync 32187 async 
49433, reads: sync 4043 async 102, fsid f244aa416aeef171)
devfs on /var/named/dev (devfs, local, fsid 02ff000404000000)
dell:/nfs on /dellbak (nfs, fsid 03ff000202000000)
dell:/nfs on /dellbak (nfs, fsid 04ff000202000000)
dell:/nfs on /dellbak (nfs, fsid 05ff000202000000)
dell:/nfs on /dellbak (nfs, fsid 06ff000202000000)
dell:/nfs on /dellbak (nfs, fsid 07ff000202000000)
dell:/nfs on /dellbak (nfs, fsid 08ff000202000000)


Any help?
Thanks.
BN


More information about the freebsd-stable mailing list