2007-08-03 17:24:21

by Chuck Lever

[permalink] [raw]
Subject: [PATCH 10/10] mount.nfs: Fix background mounts

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

Signed-off-by: Chuck Lever <[email protected]>
---

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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs


2007-08-06 22:32:01

by Steinar H. Gunderson

[permalink] [raw]
Subject: Re: [PATCH 10/10] mount.nfs: Fix background mounts

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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs