multiple NFS mounts with bg,retrycount=0

Jeremy Chadwick jdc at koitsu.org
Mon May 6 20:10:04 UTC 2013


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 rXXXXXX 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                                   jdc at koitsu.org |
| UNIX Systems Administrator                http://jdc.koitsu.org/ |
| Mountain View, CA, US                                            |
| Making life hard for others since 1977.             PGP 4BD6C0CB |


More information about the freebsd-stable mailing list