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

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.