>From b24ab737d51c67fe1210472b5eb550061b6fb308 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov <unlimitedscol...@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 and update to start the mountee. * netfs.c (netfs_validate_stat): Don't start the mountee. * update.c (_root_update_thread): Start the mountee at the first invocation. --- main.c | 10 +++++++++- netfs.c | 8 -------- update.c | 13 ++++++++++++- 3 files changed, 21 insertions(+), 10 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 <mor...@duesseldorf.ccc.de>. + Adapted for unionmount by Sergiu Ivanov <unlimitedscol...@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/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..50e93b2 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 <glgu...@gmail.com>. + Adapted for unionmount by Sergiu Ivanov <unlimitedscol...@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 @@ -64,6 +68,13 @@ _root_update_thread () ncache_reset (); + if (!mountee_started) + { + err = setup_unionmount (); + if (err) + error (EXIT_FAILURE, err, "failed to setup the mountee"); + } + rwlock_writer_unlock (&update_rwlock); } } -- 1.5.2.4