All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 10/10] mount.nfs: Fix background mounts
@ 2007-08-03 17:24 Chuck Lever
  2007-08-06 22:31 ` Steinar H. Gunderson
  0 siblings, 1 reply; 5+ messages in thread
From: Chuck Lever @ 2007-08-03 17:24 UTC (permalink / raw)
  To: neilb; +Cc: nfs

The new mount.nfs helper does not support background mounts.  Add support
for background mounts.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 utils/mount/mount.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/utils/mount/mount.c b/utils/mount/mount.c
index c0c3971..a232519 100644
--- a/utils/mount/mount.c
+++ b/utils/mount/mount.c
@@ -49,6 +49,9 @@ int nomtab;
 int verbose;
 int sloppy;
 
+#define FOREGROUND	(0)
+#define BACKGROUND	(1)
+
 static struct option longopts[] = {
   { "fake", 0, 0, 'f' },
   { "help", 0, 0, 'h' },
@@ -518,7 +521,26 @@ int main(int argc, char *argv[])
 	}
 
 	mnt_err = try_mount(spec, mount_point, flags, fs_type, &extra_opts,
-				mount_opts, fake, nomtab, 0);
+				mount_opts, fake, nomtab, FOREGROUND);
+	if (mnt_err == EX_BG) {
+		printf(_("mount: backgrounding \"%s\"\n"), spec);
+		fflush(stdout);
+
+		/*
+		 * Parent exits immediately with success.  Make
+		 * sure not to free "mount_point"
+		 */
+		if (fork() > 0)
+			exit(0);
+
+		mnt_err = try_mount(spec, mount_point, flags, fs_type,
+					&extra_opts, mount_opts, fake,
+					nomtab, BACKGROUND);
+		if (verbose && mnt_err)
+			printf(_("%s: giving up \"%s\"\n"),
+				progname, spec);
+		exit(0);
+	}
 
 out:
 	free(mount_point);


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 10/10] mount.nfs: Fix background mounts
  2007-08-03 17:24 [PATCH 10/10] mount.nfs: Fix background mounts Chuck Lever
@ 2007-08-06 22:31 ` Steinar H. Gunderson
  2007-08-07  0:00   ` Neil Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Steinar H. Gunderson @ 2007-08-06 22:31 UTC (permalink / raw)
  To: Chuck Lever; +Cc: neilb, nfs

On Fri, Aug 03, 2007 at 01:24:15PM -0400, Chuck Lever wrote:
> The new mount.nfs helper does not support background mounts.  Add support
> for background mounts.

I've now pushed the current git (which includes these patches) into Debian,
which will hopefully give us some experience with "bg" again. It seems to
have fixed some bugs of the old bg implementation, but this one still
remains:

  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=144185

Any chance mount.nfs could simply ignore HUPs?

/* Steinar */
-- 
Homepage: http://www.sesse.net/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 10/10] mount.nfs: Fix background mounts
  2007-08-06 22:31 ` Steinar H. Gunderson
@ 2007-08-07  0:00   ` Neil Brown
  2007-08-07  0:31     ` Chuck Lever
  0 siblings, 1 reply; 5+ messages in thread
From: Neil Brown @ 2007-08-07  0:00 UTC (permalink / raw)
  To: Steinar H. Gunderson; +Cc: nfs

On Tuesday August 7, sgunderson@bigfoot.com wrote:
> On Fri, Aug 03, 2007 at 01:24:15PM -0400, Chuck Lever wrote:
> > The new mount.nfs helper does not support background mounts.  Add support
> > for background mounts.
> 
> I've now pushed the current git (which includes these patches) into Debian,
> which will hopefully give us some experience with "bg" again. It seems to
> have fixed some bugs of the old bg implementation, but this one still
> remains:
> 
>   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=144185
> 
> Any chance mount.nfs could simply ignore HUPs?
> 
> /* Steinar */
> -- 
> Homepage: http://www.sesse.net/

Something like this?  Anyone want to test it?

NeilBrown


diff --git a/utils/mount/mount.c b/utils/mount/mount.c
index a232519..5769cd2 100644
--- a/utils/mount/mount.c
+++ b/utils/mount/mount.c
@@ -530,9 +530,7 @@ int main(int argc, char *argv[])
 		 * Parent exits immediately with success.  Make
 		 * sure not to free "mount_point"
 		 */
-		if (fork() > 0)
-			exit(0);
-
+		daemon(0,0);
 		mnt_err = try_mount(spec, mount_point, flags, fs_type,
 					&extra_opts, mount_opts, fake,
 					nomtab, BACKGROUND);

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 10/10] mount.nfs: Fix background mounts
  2007-08-07  0:00   ` Neil Brown
@ 2007-08-07  0:31     ` Chuck Lever
  2007-08-09 19:16       ` Steinar H. Gunderson
  0 siblings, 1 reply; 5+ messages in thread
From: Chuck Lever @ 2007-08-07  0:31 UTC (permalink / raw)
  To: Neil Brown; +Cc: nfs

[-- Attachment #1: Type: text/plain, Size: 1723 bytes --]

Neil Brown wrote:
> On Tuesday August 7, sgunderson@bigfoot.com wrote:
>> On Fri, Aug 03, 2007 at 01:24:15PM -0400, Chuck Lever wrote:
>>> The new mount.nfs helper does not support background mounts.  Add support
>>> for background mounts.
>> I've now pushed the current git (which includes these patches) into Debian,
>> which will hopefully give us some experience with "bg" again. It seems to
>> have fixed some bugs of the old bg implementation, but this one still
>> remains:
>>
>>   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=144185
>>
>> Any chance mount.nfs could simply ignore HUPs?
>>
>> /* Steinar */
>> -- 
>> Homepage: http://www.sesse.net/
> 
> Something like this?  Anyone want to test it?
> 
> NeilBrown

I copied the "bg" logic straight from util-linux, then simplified it. 
Using daemon() instead of fork() seems like a nice clean-up anyway. 
(It's just me, but I like a blank between the first and second argument 
of daemon() -- that matches the coding style in the rest of that file).

Steinar, it's not clear to me from the Debian bug report whether this is 
really a mount bug or an init scripts bug.  I assume this is something 
that did not work correctly for the legacy util-linux mount command either?

> diff --git a/utils/mount/mount.c b/utils/mount/mount.c
> index a232519..5769cd2 100644
> --- a/utils/mount/mount.c
> +++ b/utils/mount/mount.c
> @@ -530,9 +530,7 @@ int main(int argc, char *argv[])
>  		 * Parent exits immediately with success.  Make
>  		 * sure not to free "mount_point"
>  		 */
> -		if (fork() > 0)
> -			exit(0);
> -
> +		daemon(0,0);
>  		mnt_err = try_mount(spec, mount_point, flags, fs_type,
>  					&extra_opts, mount_opts, fake,
>  					nomtab, BACKGROUND);

[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 290 bytes --]

begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture: Linux Projects Group
adr:;;1015 Granger Avenue;Ann Arbor;MI;48104;USA
title:Principal Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
url:http://oss.oracle.com/~cel
version:2.1
end:vcard


[-- Attachment #3: Type: text/plain, Size: 315 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

[-- Attachment #4: Type: text/plain, Size: 140 bytes --]

_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 10/10] mount.nfs: Fix background mounts
  2007-08-07  0:31     ` Chuck Lever
@ 2007-08-09 19:16       ` Steinar H. Gunderson
  0 siblings, 0 replies; 5+ messages in thread
From: Steinar H. Gunderson @ 2007-08-09 19:16 UTC (permalink / raw)
  To: Chuck Lever; +Cc: Neil Brown, nfs

On Mon, Aug 06, 2007 at 08:31:29PM -0400, Chuck Lever wrote:
> Steinar, it's not clear to me from the Debian bug report whether this is 
> really a mount bug or an init scripts bug.

To me neither, unfortunately. The bug is something like five years old :-)
(If the code hasn't changed, I doubt it has magically fixed itself, though.)

> I assume this is something that did not work correctly for the legacy
> util-linux mount command either?

It's from way before mount was moved to nfs-utils.

/* Steinar */
-- 
Homepage: http://www.sesse.net/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-08-09 19:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-03 17:24 [PATCH 10/10] mount.nfs: Fix background mounts Chuck Lever
2007-08-06 22:31 ` Steinar H. Gunderson
2007-08-07  0:00   ` Neil Brown
2007-08-07  0:31     ` Chuck Lever
2007-08-09 19:16       ` Steinar H. Gunderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.