From nobody@FreeBSD.org  Sun Sep 10 10:32:27 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id C6DCD16A412
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 10 Sep 2006 10:32:27 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 915E243D49
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 10 Sep 2006 10:32:27 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k8AAWR2s085567
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 10 Sep 2006 10:32:27 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k8AAWRKc085566;
	Sun, 10 Sep 2006 10:32:27 GMT
	(envelope-from nobody)
Message-Id: <200609101032.k8AAWRKc085566@www.freebsd.org>
Date: Sun, 10 Sep 2006 10:32:27 GMT
From: Dominic Fandrey <lon_kamikaze@gmx.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [sbin/mount_nfs] introduce new option
X-Send-Pr-Version: www-2.3

>Number:         103089
>Category:       bin
>Synopsis:       [patch] mount_nfs(8): introduce new option
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 10 10:40:22 GMT 2006
>Closed-Date:    Tue Mar 04 04:14:49 UTC 2008
>Last-Modified:  Tue Mar 04 04:14:49 UTC 2008
>Originator:     Dominic Fandrey
>Release:        Releng_6
>Organization:
private
>Environment:
FreeBSD mobileKamikaze.norad 6.1-STABLE FreeBSD 6.1-STABLE #0: Sat Sep  9 17:31:18 CEST 2006     root@homeKamikaze.norad:/usr/obj/usr/src/sys/TPR40-6  i386
>Description:
In environments where a successful mount is rather unlikely (such as on a laptop) the use of the -b option is quite frustrating, because a failed attempt takes quite some time.

As an example I've got 4 nfs mounts in my fstab (with the -b option) and it delays booting by ~2 minutes, when I'm not in my home network, because a connection attempt takes a remarkable amount of time. This is why I added the -B option. Instead of waiting for the connection to the server to fail, it instantly forks (unless not already forked, which might be the case if someone added -B several times).

I suppose with only slight changes the patch could be applied to mount_nfs4 as well.
>How-To-Repeat:

>Fix:
diff -uPr sbin/mount_nfs.orig/mount_nfs.8 sbin/mount_nfs/mount_nfs.8
--- sbin/mount_nfs.orig/mount_nfs.8	Sun Sep 10 12:05:33 2006
+++ sbin/mount_nfs/mount_nfs.8	Sun Sep 10 12:16:00 2006
@@ -163,6 +163,11 @@
 Useful for
 .Xr fstab 5 ,
 where the file system mount is not critical to multiuser operation.
+.It Fl B
+Fork off a child immediately, even before the first attempt to contact the
+server. Useful for
+.Xr fstab 5 ,
+where notification about failiure is not desired.
 .It Fl c
 For UDP mount points, do not do a
 .Xr connect 2 .
diff -uPr sbin/mount_nfs.orig/mount_nfs.c sbin/mount_nfs/mount_nfs.c
--- sbin/mount_nfs.orig/mount_nfs.c	Sun Sep 10 12:05:33 2006
+++ sbin/mount_nfs/mount_nfs.c	Sun Sep 10 12:05:02 2006
@@ -278,6 +278,14 @@
 		case 'b':
 			opflags |= BGRND;
 			break;
+		case 'B':
+			opflags |= BGRND;
+			if ((opflags & (BGRND | ISBGRND)) == BGRND) {
+				opflags |= ISBGRND;
+				if (daemon(0, 0) != 0)
+					err(1, "daemon");
+			}
+			break;
 		case 'c':
 			nfsargsp->flags |= NFSMNT_NOCONN;
 			break;

>Release-Note:
>Audit-Trail:

From: "[LoN]Kamikaze" <LoN_Kamikaze@gmx.de>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: misc/103089: [sbin/mount_nfs] introduce new option
Date: Sun, 10 Sep 2006 12:47:20 +0200

 In my foolish haste I submitted the wrong patch. This one actually works.
 
 
 
 diff -Pur sbin/mount_nfs.orig/mount_nfs.8 sbin/mount_nfs/mount_nfs.8
 --- sbin/mount_nfs.orig/mount_nfs.8	Thu Feb 10 10:19:30 2005
 +++ sbin/mount_nfs/mount_nfs.8	Sun Sep 10 12:37:51 2006
 @@ -36,7 +36,7 @@
  .Nd mount NFS file systems
  .Sh SYNOPSIS
  .Nm
 -.Op Fl 23bcdiLlNPsTU
 +.Op Fl 23bBcdiLlNPsTU
  .Op Fl a Ar maxreadahead
  .Op Fl D Ar deadthresh
  .Op Fl g Ar maxgroups
 @@ -163,6 +163,11 @@
  Useful for
  .Xr fstab 5 ,
  where the file system mount is not critical to multiuser operation.
 +.It Fl B
 +Fork off a child immediately, even before the first attempt to contact the
 +server. Useful for
 +.Xr fstab 5 ,
 +where notification about failiure is not desired.
  .It Fl c
  For UDP mount points, do not do a
  .Xr connect 2 .
 diff -Pur sbin/mount_nfs.orig/mount_nfs.c sbin/mount_nfs/mount_nfs.c
 --- sbin/mount_nfs.orig/mount_nfs.c	Fri Jun 10 11:51:41 2005
 +++ sbin/mount_nfs/mount_nfs.c	Sun Sep 10 12:38:50 2006
 @@ -260,7 +260,7 @@
  	nfsargs = nfsdefargs;
  	nfsargsp = &nfsargs;
  	while ((c = getopt(argc, argv,
 -	    "23a:bcdD:g:I:iLlNo:PR:r:sTt:w:x:U")) != -1)
 +	    "23a:bBcdD:g:I:iLlNo:PR:r:sTt:w:x:U")) != -1)
  		switch (c) {
  		case '2':
  			mountmode = V2;
 @@ -278,6 +278,14 @@
  		case 'b':
  			opflags |= BGRND;
  			break;
 +		case 'B':
 +			opflags |= BGRND;
 +			if ((opflags & (BGRND | ISBGRND)) == BGRND) {
 +				opflags |= ISBGRND;
 +				if (daemon(0, 0) != 0)
 +					err(1, "daemon");
 +			}
 +			break;
  		case 'c':
  			nfsargsp->flags |= NFSMNT_NOCONN;
  			break;
 @@ -918,7 +926,7 @@
  usage()
  {
  	(void)fprintf(stderr, "%s\n%s\n%s\n%s\n",
 -"usage: mount_nfs [-23bcdiLlNPsTU] [-a maxreadahead] [-D deadthresh]",
 +"usage: mount_nfs [-23bBcdiLlNPsTU] [-a maxreadahead] [-D deadthresh]",
  "                 [-g maxgroups] [-I readdirsize] [-o options] [-R retrycnt]",
  "                 [-r readsize] [-t timeout] [-w writesize] [-x retrans]",
  "                 rhost:path node");

From: Dominic Fandrey <kamikaze@bsdforen.de>
To: bug-followup@FreeBSD.org, lon_kamikaze@gmx.de
Cc:  
Subject: Re: bin/103089: [patch] mount_nfs(8): introduce new option
Date: Mon, 03 Mar 2008 18:55:47 +0100

 There seems to be no interest in this. I'm not using that myself any more, I 
 suggest you just close it.
State-Changed-From-To: open->suspended 
State-Changed-By: linimon 
State-Changed-When: Mon Mar 3 20:03:23 UTC 2008 
State-Changed-Why:  
Submitter is no longer interested in pursuing this, but leave it in 
'suspended' in case someone else wants to pick it up. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=103089 
State-Changed-From-To: suspended->closed 
State-Changed-By: linimon 
State-Changed-When: Tue Mar 4 04:14:32 UTC 2008 
State-Changed-Why:  
Submitter really recommends that this just be closed instead. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=103089 
>Unformatted:
