multiple NFS mounts with bg,retrycount=0

2013-05-06 Thread Navdeep Parhar
I updated a FreeBSD 9-STABLE system to r250290 and noticed an NFS oddity
-- fstab entries that specify a retrycnt are mounted multiple times.

I have this in /etc/fstab:
:/remote/ /local/ nfs rw,bg,retrycnt=0 0 0

And this in /etc/rc.conf:
rpcbind_enable=YES
nfs_client_enable=YES
nfs_server_enable=YES
nfsv4_server_enable=YES
nfsuserd_flags=-domain XX
rpc_lockd_enable=YES
rpc_statd_enable=YES

If I run mount immediately after the system boots up I don't see
anything mounted on /local/.  If I wait a minute or so and recheck I
see two identical mounts on /local/.

# mount | grep /local
:/remote/ on /local/ (nfs)
:/remote/ on /local/ (nfs)

It is almost as if the system tried to mount the remote FS, failed, and
then forked multiple (?) processes to retry the operation, and all of
them succeed later.  Unfortunately, I can't reboot the system for a
couple of days so I can't go looking for mount_nfs processes right after
a fresh boot.

Regards,
Navdeep
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org


Re: multiple NFS mounts with bg,retrycount=0

2013-05-06 Thread Zaphod Beeblebrox
[about double background NFS mounts]

I'm not sure on the fix to this, but I'm pretty sure it's because we retry
the mount -a stuff twice at startup.  If you watch your console, you'll see
two places where it will mount NFS filesystems during boot.

... well... a fix to this would be to _not_ do that twice ... but hey :).
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org


Re: multiple NFS mounts with bg,retrycount=0

2013-05-06 Thread Jeremy Chadwick
On Mon, May 06, 2013 at 03:46:51PM -0400, Zaphod Beeblebrox wrote:
 [about double background NFS mounts]
 
 I'm not sure on the fix to this, but I'm pretty sure it's because we retry
 the mount -a stuff twice at startup.  If you watch your console, you'll see
 two places where it will mount NFS filesystems during boot.
 
 ... well... a fix to this would be to _not_ do that twice ... but hey :).

Preface: I'm not aware of mount(8) actually permitting the mounting of
two NFS filesystems at the same mountpoint (e.g. wouldn't the 2nd one
throw EPERM or some other condition?).

When I ran my co-lo, we used NFS on many client machines (on RELENG_8
and RELENG_9) and we *never* saw multiple mounts (to the same
mountpoint) on reboot.  I also don't remember seeing the message in
question twice -- only once.

That said:

Can you please determine if /etc/rc.d/mountcritremote is doing this?
This is the only script which issues such echo statements.  The
relevant portion of the script:

 35 mountcritremote_start()
 36 {
 37 # Mount nfs filesystems.
 38 #
 39 case `/sbin/mount -d -a -t nfs` in
 40 '')
 41 ;;
 42 *)
 43 echo -n 'Mounting NFS file systems:'
 44 mount -a -t nfs
 45 echo '.'
 46 ;;
 47 esac
 48
 49 # Mount other network filesystems if present in /etc/fstab.
 50 case ${extra_netfs_types} in
 51 [Nn][Oo])
 52 ;;
 53 *)
 54 netfs_types=${netfs_types} ${extra_netfs_types}
 55 ;;
 56 esac
 57
 58 for i in ${netfs_types}; do
 59 fstype=${i%:*}
 60 fsdecr=${i#*:}
 61
 62 [ ${fstype} = nfs ]  continue
 63
 64 case `mount -d -a -t ${fstype}` in
 65 *mount_${fstype}*)
 66 echo -n Mounting ${fsdecr} file systems:
 67 mount -a -t ${fstype}
 68 echo '.'
 69 ;;
 70 esac
 71 done

And the defaults for $netfs_types and $extra_netfs_types:

netfs_types=nfs:NFS oldnfs:OLDNFS smbfs:SMB portalfs:PORTAL nwfs:NWFS # Net 
filesystems.
extra_netfs_types=NO# List of network extra filesystem types for delayed

Now look at lines 58 through 62 above (specifically 62).  $fstype
should contain nfs thus should be skipped over.  And oldnfs would
cause the echo statement to be Mounting OLDNFS file systems:.

If you could try to figure out where/what rc script is causing this
for you, that'd be great.

And a final point: disclose of exactly what FreeBSD version you're using
(including build date or SVN rXX number) would be wonderful.  The
reason I mention that is because mountcritremote has been adjusted
**after** 9.1-RELEASE (see r242153):

http://svnweb.freebsd.org/base/stable/9/etc/rc.d/mountcritremote

Let us know what you find.

-- 
| Jeremy Chadwick   j...@koitsu.org |
| UNIX Systems Administratorhttp://jdc.koitsu.org/ |
| Mountain View, CA, US|
| Making life hard for others since 1977. PGP 4BD6C0CB |
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org


Re: multiple NFS mounts with bg,retrycount=0

2013-05-06 Thread O. Hartmann
On Mon, 2013-05-06 at 10:48 -0700, Navdeep Parhar wrote:
 I updated a FreeBSD 9-STABLE system to r250290 and noticed an NFS oddity
 -- fstab entries that specify a retrycnt are mounted multiple times.
 
 I have this in /etc/fstab:
 :/remote/ /local/ nfs rw,bg,retrycnt=0 0 0
 
 And this in /etc/rc.conf:
 rpcbind_enable=YES
 nfs_client_enable=YES
 nfs_server_enable=YES
 nfsv4_server_enable=YES
 nfsuserd_flags=-domain XX
 rpc_lockd_enable=YES
 rpc_statd_enable=YES
 
 If I run mount immediately after the system boots up I don't see
 anything mounted on /local/.  If I wait a minute or so and recheck I
 see two identical mounts on /local/.
 
 # mount | grep /local
 :/remote/ on /local/ (nfs)
 :/remote/ on /local/ (nfs)
 
 It is almost as if the system tried to mount the remote FS, failed, and
 then forked multiple (?) processes to retry the operation, and all of
 them succeed later.  Unfortunately, I can't reboot the system for a
 couple of days so I can't go looking for mount_nfs processes right after
 a fresh boot.
 
 Regards,
 Navdeep


I see the very same here on FreeBSD 10.0-CURRENT boxes (two boxes acting
as NFSv4 server). The clients (all FBSD 10, one 9.1-STABLE) have two(!)
identical mounts of the very same filesystem.

/etc/fstab does contain the mount option bg, but not retrycnt=0.

This behaviour happens on ALL FBSD 10.0-CURRENT boxes I administer
(10.0-CURRENT #0 r250275: Sun May  5 18:40:17 CEST 2013 amd64).


Regards,

Oliver


signature.asc
Description: This is a digitally signed message part


Re: multiple NFS mounts with bg,retrycount=0

2013-05-06 Thread Rick Macklem
Zaphrod Beeblebrox wrote:
 [about double background NFS mounts]
 
 I'm not sure on the fix to this, but I'm pretty sure it's because we
 retry
 the mount -a stuff twice at startup. If you watch your console, you'll
 see
 two places where it will mount NFS filesystems during boot.
 
 ... well... a fix to this would be to _not_ do that twice ... but hey
 :).
There was just a commit to head (r250253) which adds a -L option to
mount, so that only late file systems are mounted, to avoid this.

Without this, what I think happens is:
A - mount -a -- initial mount attempt fails and goes background
B - mount -a -l -- succeeds in doing the mount, since it isn't
mounted yet
  - background mount_nfs from (A) wakes up and does the mount again

Yes, doing the mount twice will work and the second mount covers up
the first one. This is relatively harmless, although it will take
2 umounts to get rid of the mount (the first umount just uncovers
the first mount).

You could try marking the /etc/fstab line(s) for the mounts late.
(since you use bg, I'm assuming they aren't needed to be done
 for the startup scripts) That way they would only be mounted for
the mount -a -l case, I think.

rick


 ___
 freebsd-stable@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-stable
 To unsubscribe, send any mail to
 freebsd-stable-unsubscr...@freebsd.org
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org