Billy Newsom
2005-May-09 21:14 UTC
nfs bug & df: Can I lock up my kernel and overflow this buffer?
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
Kris Kennaway
2005-May-09 21:33 UTC
nfs bug & df: Can I lock up my kernel and overflow this buffer?
On Mon, May 09, 2005 at 11:14:51PM -0500, Billy Newsom wrote:> 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.Why do you think so?> 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% /dellbakWhy's it ridiculous? You mounted it more than once, so it appears more than once in the list of mounted filesystems.> * Look at the fsid for /dellbak below, using verbose output. Pretty odd.Why is it odd? The fsid is by definition different for different mounts. Kris -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: not available Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20050509/649490f5/attachment.bin
Jonathan Noack
2005-May-09 21:41 UTC
nfs bug & df: Can I lock up my kernel and overflow this buffer?
On 05/09/05 23:14, Billy Newsom wrote:> <snip> > > 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 /dellbakFrom the fstab(5) man page: "The fourth field, (fs_mntops), describes the mount options associated with the file system. It is formatted as a comma separated list of options. It contains at least the type of mount (see fs_type below) plus any additional options appropriate to the file system type. See the options flag (-o) in the mount(8) page and the file system specific page, such as mount_nfs(8), for additional options that may be specified." What trouble did you have with fstab? You can specify as many options as you want as long as you separate them with commas (I think putting a '=' between an option and its value is also necessary, although I don't know for sure). For you it should look like this (assuming you want read/write): dell:/nfs /dellbak nfs rw,-s,-x=2,-T 0 0 -- Jonathan Noack | noackjr@alumni.rice.edu | OpenPGP: 0x991D8195 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 187 bytes Desc: OpenPGP digital signature Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20050509/90b69051/signature.bin