Re: mount -p and NFS options
On Tue, 5 Feb 2008, Dan Nelson wrote: In the last episode (Feb 04), Mike Andrews said: Is there anything like mount -p that will print the current NFS options in use? TCP vs UDP, v2 vs v3, read/write sizes etc. It doesn't have to be in fstab format; I just need to be able to see what the flags are for an active mount. This would be useful in tracking down an irritating NFS problem I've been experiencing with diskless systems in every 6.x release and 7.0-RC1, namely libc.so.6 appears to be truncated or corrupt to the client at somewhat random times... I think it may be related to mount options, hence the question. Theoretically, any filesystem that uses nmount(2) should have its options recored in an easy-to-extract format, since one of the arguments to nmount is an array of options. I patched my kernel and /sbin/mount binary to do this (borrowing the f_charspare field in struct statfs), and it mostly works. The stuff below in brackets are from the options array. You can see that cd9660 was mounted with the option ssector=0: [snip] Unfortunately, mount_nfs simply calls nmount with a single nfs_args option whose value is the same binary struct nfs_args it used to call mount(2) with :( The fix would be to make nfs_vfsops.c and mount_nfs.c use the options array instead of a custom struct, but nfs_vfsops.c:nfs_decode_args scares me off every time I look at it. Hm. Well, that's a bummer. But it at least told me where to hack in some temporary printf() calls, and that helped me narrow my immediate problem down to the rsize/wsize parameters. My problem was, on a diskless 7.0-RC1 system, trying to compile anything resulted in ld SIGSEGV'ing. With diskless 6.3 ld said that libc.so.6 was truncated. ktrace hinted that 7.0's ld crash was right after reading libc.so.7 so it's probably the same issue -- problems reading libc. The problem goes away if I change rsize/wsize from 32K down to 16K or the default 8K, at least with TCP mounts. So for now in /boot/loader.conf I'm using boot.nfsroot.options=nfsv3 tcp rsize=8192 wsize=8192. (NFS options for the root filesystem in fstab seem to be ignored.) I don't know why it was libc consistently getting misread and why other files seem to always work, or why mounting other NFS filesystems with a 32K blocksize work fine... unless I'm hitting some edge case that's specific to NFS root vs NFS anything-else. Anyway, I've got a workaround for now. (FWIW, this happened with two different machines, one with an msk NIC and one with an em NIC, neither of which have jumbo frames enabled.) ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: mount -p and NFS options
In the last episode (Feb 04), Mike Andrews said: Is there anything like mount -p that will print the current NFS options in use? TCP vs UDP, v2 vs v3, read/write sizes etc. It doesn't have to be in fstab format; I just need to be able to see what the flags are for an active mount. This would be useful in tracking down an irritating NFS problem I've been experiencing with diskless systems in every 6.x release and 7.0-RC1, namely libc.so.6 appears to be truncated or corrupt to the client at somewhat random times... I think it may be related to mount options, hence the question. Theoretically, any filesystem that uses nmount(2) should have its options recored in an easy-to-extract format, since one of the arguments to nmount is an array of options. I patched my kernel and /sbin/mount binary to do this (borrowing the f_charspare field in struct statfs), and it mostly works. The stuff below in brackets are from the options array. You can see that cd9660 was mounted with the option ssector=0: ([EMAIL PROTECTED]) /root# mount local/root on / (zfs, NFS exported, local, rw,noro) devfs on /dev (devfs, local, ) /dev/ufs/boot on /.boot (ufs, local, soft-updates, rw,noro) procfs on /proc (procfs, local, rw,noro) /dev/md0 on /tmp (ufs, NFS exported, local, ) /dev/cd0 on /cdrom (cd9660, NFS exported, local, read-only, ro,ssector=0) Unfortunately, mount_nfs simply calls nmount with a single nfs_args option whose value is the same binary struct nfs_args it used to call mount(2) with :( The fix would be to make nfs_vfsops.c and mount_nfs.c use the options array instead of a custom struct, but nfs_vfsops.c:nfs_decode_args scares me off every time I look at it. -- Dan Nelson [EMAIL PROTECTED] Index: sys/kern/vfs_mount.c === RCS file: /home/ncvs/src/sys/kern/vfs_mount.c,v retrieving revision 1.265.2.2 diff -u -p -r1.265.2.2 vfs_mount.c --- sys/kern/vfs_mount.c 17 Jan 2008 04:24:53 - 1.265.2.2 +++ sys/kern/vfs_mount.c 18 Jan 2008 23:13:48 - @@ -1020,6 +1020,40 @@ vfs_domount( if (mp-mnt_opt != NULL) vfs_freeopts(mp-mnt_opt); mp-mnt_opt = mp-mnt_optnew; + + /* Collapse the mount options into a readable string */ + mp-mnt_stat.f_charspare[0]=0; + if (mp-mnt_opt) { + struct vfsopt *opt; + struct sbuf *sb; + + sb = sbuf_new(NULL, mp-mnt_stat.f_charspare, +sizeof(mp-mnt_stat.f_charspare), +SBUF_FIXEDLEN); + TAILQ_FOREACH(opt, mp-mnt_opt, link) { +/* + * Skip options that are temporary, stored + * elsewhere in struct statfs, or are structs + */ +if (strcmp(opt-name,errmsg) == 0 || +strcmp(opt-name,from) == 0 || +strcmp(opt-name,fspath) == 0 || +strcmp(opt-name,fstype) == 0 || +strcmp(opt-name,nfs_args) == 0 || +strcmp(opt-name,update) == 0 ) + continue; +if (sbuf_len(sb)) + sbuf_cat(sb, ,); +sbuf_cat(sb, opt-name); +if (opt-len) { + sbuf_cat(sb, =); + sbuf_cat(sb, opt-value); +} + } + sbuf_finish(sb); + sbuf_delete(sb); + } + (void)VFS_STATFS(mp, mp-mnt_stat, td); } /* Index: sbin/mount/mount.c === RCS file: /home/ncvs/src/sbin/mount/mount.c,v retrieving revision 1.96 diff -u -p -r1.96 mount.c --- sbin/mount/mount.c 25 Jun 2007 05:06:54 - 1.96 +++ sbin/mount/mount.c 2 Oct 2007 21:20:18 - @@ -596,6 +596,7 @@ prmount(struct statfs *sfp) (void)printf(, %s, o-o_name); flags = ~o-o_opt; } + printf(, %s,sfp-f_charspare); /* * Inform when file system is mounted by an unprivileged user * or privileged non-root user. ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to [EMAIL PROTECTED]
mount -p and NFS options
Is there anything like mount -p that will print the current NFS options in use? TCP vs UDP, v2 vs v3, read/write sizes etc. It doesn't have to be in fstab format; I just need to be able to see what the flags are for an active mount. This would be useful in tracking down an irritating NFS problem I've been experiencing with diskless systems in every 6.x release and 7.0-RC1, namely libc.so.6 appears to be truncated or corrupt to the client at somewhat random times... I think it may be related to mount options, hence the question. Mike Andrews * [EMAIL PROTECTED] * http://www.bit0.com It's not news, it's Fark.com. Carpe cavy! ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to [EMAIL PROTECTED]