bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Enable the mountee to be started after initialization.


From: Sergiu Ivanov
Subject: Re: [PATCH] Enable the mountee to be started after initialization.
Date: Mon, 13 Jul 2009 17:10:01 +0300
User-agent: Mutt/1.5.18 (2008-05-17)

>From 190cae3ebd013ac5e168fae9b9f50456e3d4679a Mon Sep 17 00:00:00 2001
From: Sergiu Ivanov <unlimitedscolobb@gmail.com>
Date: Sun, 5 Jul 2009 23:49:14 +0300
Subject: [PATCH] Enable the mountee to be started after initialization.

* main.c (main): Schedule an update to start the mountee.
* mount.c (setup_unionmount): Don't force the update of the lists
of filesystems.
* netfs.c (netfs_validate_stat): Don't start the mountee.
* update.c (_root_update_thread): Start the mountee at the
first invocation.
---

This patch is an improved version: by invoking setup_unionmount in a
different place of _root_update_thread, it removes the necessity of
forcing a (repeated, actually) update of the list of filesystems in
setup_unionmount.

---
 main.c   |   10 +++++++++-
 mount.c  |    4 ----
 netfs.c  |    8 --------
 update.c |   13 ++++++++++++-
 4 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/main.c b/main.c
index c33b065..9b8b5e7 100644
--- a/main.c
+++ b/main.c
@@ -1,7 +1,10 @@
 /* Hurd unionfs
-   Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2005, 2009 Free Software Foundation, Inc.
+
    Written by Moritz Schulte <moritz@duesseldorf.ccc.de>.
 
+   Adapted for unionmount by Sergiu Ivanov <unlimitedscolobb@gmail.com>.
+
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
    published by the Free Software Foundation; either version 2 of the
@@ -128,6 +131,11 @@ main (int argc, char **argv)
   fshelp_touch (&netfs_root_node->nn_stat,
                TOUCH_ATIME | TOUCH_MTIME | TOUCH_CTIME, maptime);
 
+  /* The update thread will start the mountee when unionfs will be
+     ready for servicing RPCs (will have completed the
+     initialization).  */
+  root_update_schedule ();
+
   /* Start serving clients.  */
   for (;;)
     netfs_server_loop ();
diff --git a/mount.c b/mount.c
index 8671ae6..40c53c1 100644
--- a/mount.c
+++ b/mount.c
@@ -208,10 +208,6 @@ setup_unionmount (void)
      mountee port.  */
   ulfs_register ("", 0, 0);
 
-  /* Initialize the list of merged filesystems.  */
-  ulfs_check ();
-  node_init_root (netfs_root_node);
-
   mountee_started = 1;
 
   return err;
diff --git a/netfs.c b/netfs.c
index 01e8ae9..1c9541e 100644
--- a/netfs.c
+++ b/netfs.c
@@ -40,7 +40,6 @@
 #include "lib.h"
 #include "ncache.h"
 #include "options.h"
-#include "mount.h"
 
 /* Return an argz string describing the current options.  Fill *ARGZ
    with a pointer to newly malloced storage holding the list and *LEN
@@ -170,13 +169,6 @@ netfs_validate_stat (struct node *np, struct iouser *cred)
     }
   else 
     {
-      if (!mountee_started)
-       {
-         err = setup_unionmount ();
-         if (err)
-           error (EXIT_FAILURE, err, "failed to setup the mountee");
-       }
-
       _get_node_size (np, &np->nn_stat.st_size); 
     }
 
diff --git a/update.c b/update.c
index 8ec6688..1c85ccc 100644
--- a/update.c
+++ b/update.c
@@ -1,7 +1,10 @@
 /* Hurd unionfs
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+
    Written by Gianluca Guida <glguida@gmail.com>.
 
+   Adapted for unionmount by Sergiu Ivanov <unlimitedscolobb@gmail.com>.
+
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
    published by the Free Software Foundation; either version 2 of the
@@ -30,6 +33,7 @@
 #include "ncache.h"
 #include "node.h"
 #include "ulfs.h"
+#include "mount.h"
 
 /* Reader lock is used by threads that are going to
    add/remove an ulfs; writer lock is hold by the 
@@ -50,6 +54,13 @@ _root_update_thread ()
 
       rwlock_writer_lock (&update_rwlock);
 
+      if (!mountee_started)
+       {
+         err = setup_unionmount ();
+         if (err)
+           error (EXIT_FAILURE, err, "failed to setup the mountee");
+       }
+
       do 
        {
          ulfs_check();
-- 
1.6.3.3





reply via email to

[Prev in Thread] Current Thread [Next in Thread]