From nobody@FreeBSD.org  Mon Aug 10 10:24:44 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BA6CC1065670
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 10 Aug 2009 10:24:44 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id A9EA28FC25
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 10 Aug 2009 10:24:44 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n7AAOiuM037317
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 10 Aug 2009 10:24:44 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n7AAOisD037293;
	Mon, 10 Aug 2009 10:24:44 GMT
	(envelope-from nobody)
Message-Id: <200908101024.n7AAOisD037293@www.freebsd.org>
Date: Mon, 10 Aug 2009 10:24:44 GMT
From: Jochen Keil <j.keil@gmx.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: background_dhclient rc.conf option causing double nfs mounts
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         137629
>Category:       conf
>Synopsis:       [rc.d] background_dhclient rc.conf option causing double nfs mounts
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    crees
>State:          patched
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 10 10:30:02 UTC 2009
>Closed-Date:    
>Last-Modified:  Sat May  4 14:10:00 UTC 2013
>Originator:     Jochen Keil
>Release:        7.2-RELEASE
>Organization:
>Environment:
FreeBSD monolith.lokal.lan 7.2-STABLE FreeBSD 7.2-STABLE #0: Wed Aug  5 10:11:22 CEST 2009     root@monolith.lokal.lan:/usr/obj/usr/src/sys/MONOLITH  i386
>Description:
One or more NFS mountpoints listed in fstab similar to this one:
192.168.1.1:/pub  /pub  nfs  ro,-b,-i  0  0

set background_dhclient="YES" in /etc/rc.conf.

This will result in /pub (and other mountpoints) getting mounted twice on boot.
Output from mount looks something like that:
$ mount
[..]
192.168.1.1:/pub on /pub (nfs, read-only)
[..]
192.168.1.1:/pub on /pub (nfs, read-only)

Setting background_dhclient="NO" fixes the problem.
>How-To-Repeat:
Set background_dhclient="YES" in /etc/rc.conf and put a NFS mount with option "-b" into /etc/fstab.
>Fix:
Set background_dhclient="NO" in /etc/rc.conf

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-rc 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Aug 10 15:44:37 UTC 2009 
Responsible-Changed-Why:  
I'm not sure if this is a problem in the rc scripts or not.  Comments? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=137629 
State-Changed-From-To: open->analyzed 
State-Changed-By: crees 
State-Changed-When: Thu Nov 1 19:50:27 UTC 2012 
State-Changed-Why:  
I think that background_dhclient assumes that you won't need access to 
the network during boot.  Otherwise, the only option is to check it's 
finished before declaring NETWORKING satisfied, and that defeats the 
object of background_dhclient. 

I'll look at putting a note into defaults/rc.conf to warn of this 

http://www.freebsd.org/cgi/query-pr.cgi?pr=137629 
State-Changed-From-To: analyzed->closed 
State-Changed-By: crees 
State-Changed-When: Thu Nov 1 20:00:49 UTC 2012 
State-Changed-Why:  
Actually, pointed out by mjg@, you should use the "late" option in 
/etc/fstab to avoid this; NFS should always be used with this option, so 
that the filesystems are mounted after the early/late divider. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=137629 
State-Changed-From-To: closed->analyzed 
State-Changed-By: crees 
State-Changed-When: Thu Nov 1 20:10:09 UTC 2012 
State-Changed-Why:  
However, this is actually a bug. 

rc.d/mountlate uses mount -a -d -l to find the filesystems to mount, 
which assumes that all previous mounts were successful.  However, if an 
NFS mount is still awaited, it is included in that list. 

I think we'll need a mountlateremote script at first sight, but it could 
be simpler. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=137629 
Responsible-Changed-From-To: freebsd-rc->crees 
Responsible-Changed-By: crees 
Responsible-Changed-When: Thu Nov 1 20:13:38 UTC 2012 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=137629 
State-Changed-From-To: analyzed->feedback 
State-Changed-By: crees 
State-Changed-When: Fri Nov 2 10:27:52 UTC 2012 
State-Changed-Why:  
Looks horrible, but this does what you want; 
http://www.bayofrum.net/~crees/patches/137629.diff  I'll discuss this on 
the rc@ list before getting it in. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=137629 
State-Changed-From-To: feedback->patched 
State-Changed-By: crees 
State-Changed-When: Sat May 4 14:06:48 UTC 2013 
State-Changed-Why:  
Patched in head 

http://www.freebsd.org/cgi/query-pr.cgi?pr=137629 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/137629: commit references a PR
Date: Sat,  4 May 2013 14:00:30 +0000 (UTC)

 Author: crees (ports committer)
 Date: Sat May  4 14:00:16 2013
 New Revision: 250235
 URL: http://svnweb.freebsd.org/changeset/base/250235
 
 Log:
   Introduce and use new flag -L to mount for mounting only late filesystems.
   
   Previously, rc.d/mountlate mounted *all* filesystems, causing problems with
   background NFS mounts being mounted twice.
   
   PR:		conf/137629
   Submitted by:	eadler (original concept)
   Reviewed by:	mjg
   Approved by:	hrs
 
 Modified:
   head/etc/rc.d/mountlate
   head/sbin/mount/mount.8
   head/sbin/mount/mount.c
 
 Modified: head/etc/rc.d/mountlate
 ==============================================================================
 --- head/etc/rc.d/mountlate	Sat May  4 12:57:21 2013	(r250234)
 +++ head/etc/rc.d/mountlate	Sat May  4 14:00:16 2013	(r250235)
 @@ -21,19 +21,10 @@ mountlate_start()
  	# Mount "late" filesystems.
  	#
  	err=0
 -	latefs=
 -	# / (root) fs is always remounted, so remove from list
 -	latefs="`/sbin/mount -d -a -l | grep -v ' /$'`"
 -	case ${latefs} in
 -	'')
 -		;;
 -	*)
 -		echo -n 'Mounting late file systems:'
 -		mount -a -l
 -		err=$?
 -		echo '.'
 -		;;
 -	esac
 +	echo -n 'Mounting late file systems:'
 +	mount -a -L
 +	err=$?
 +	echo '.'
  
  	case ${err} in
  	0)
 
 Modified: head/sbin/mount/mount.8
 ==============================================================================
 --- head/sbin/mount/mount.8	Sat May  4 12:57:21 2013	(r250234)
 +++ head/sbin/mount/mount.8	Sat May  4 14:00:16 2013	(r250235)
 @@ -106,6 +106,13 @@ a file system mount status from read-wri
  Also
  forces the R/W mount of an unclean file system (dangerous; use with
  caution).
 +.It Fl L
 +When used in conjunction with the
 +.Fl a
 +option, mount
 +.Em only
 +those file systems which are marked as
 +.Dq Li late .
  .It Fl l
  When used in conjunction with the
  .Fl a
 
 Modified: head/sbin/mount/mount.c
 ==============================================================================
 --- head/sbin/mount/mount.c	Sat May  4 12:57:21 2013	(r250234)
 +++ head/sbin/mount/mount.c	Sat May  4 14:00:16 2013	(r250235)
 @@ -245,14 +245,15 @@ main(int argc, char *argv[])
  	struct fstab *fs;
  	struct statfs *mntbuf;
  	int all, ch, i, init_flags, late, failok, mntsize, rval, have_fstab, ro;
 +	int onlylate;
  	char *cp, *ep, *options;
  
 -	all = init_flags = late = 0;
 +	all = init_flags = late = onlylate = 0;
  	ro = 0;
  	options = NULL;
  	vfslist = NULL;
  	vfstype = "ufs";
 -	while ((ch = getopt(argc, argv, "adF:flo:prt:uvw")) != -1)
 +	while ((ch = getopt(argc, argv, "adF:fLlo:prt:uvw")) != -1)
  		switch (ch) {
  		case 'a':
  			all = 1;
 @@ -266,6 +267,10 @@ main(int argc, char *argv[])
  		case 'f':
  			init_flags |= MNT_FORCE;
  			break;
 +		case 'L':
 +			onlylate = 1;
 +			late = 1;
 +			break;
  		case 'l':
  			late = 1;
  			break;
 @@ -327,6 +332,8 @@ main(int argc, char *argv[])
  					continue;
  				if (hasopt(fs->fs_mntops, "noauto"))
  					continue;
 +				if (!hasopt(fs->fs_mntops, "late") && onlylate)
 +					continue;
  				if (hasopt(fs->fs_mntops, "late") && !late)
  					continue;
  				if (hasopt(fs->fs_mntops, "failok"))
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
