mirror of
https://github.com/troglobit/finit.git
synced 2026-10-23 11:44:37 +00:00
Follow-up to c9fe9afa, proper fix for HOOK_BASFFS_UP mess
Instead of the revert in c9fe9afa, we restore HOOK_BASFFS_UP to its
proper place at the end of fs_mount_all(). For this to not cause any
regressions we add a new hook, HOOK_SVC_PLUGIN, and update all plugins
that call service_register() to run at the new hook.
This will cause regressions for external 3rd party plugins that rely on
HOOK_BASEFS_UP to be called at its previous postion. Nevertheless, this
is the proper fix to the problem.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
a664fd7192
commit
82dfa002ff
7 files changed
+24
-21
No files matched your search
@@ -168,6 +168,12 @@ hook points:
|
|||||||
* `HOOK_BASEFS_UP`, `hook/mount/all`: All of `/etc/fstab` is mounted,
|
* `HOOK_BASEFS_UP`, `hook/mount/all`: All of `/etc/fstab` is mounted,
|
||||||
swap is available and default init signals are setup
|
swap is available and default init signals are setup
|
||||||
|
|
||||||
|
* `HOOK_SVC_PLUGIN`, `hook/svc/plugin`: Called in `conf_init()` right
|
||||||
|
before loading `/etc/finit.conf`. For plugins to register any early
|
||||||
|
run/task/services, please do NOT use any earlier hook point. That
|
||||||
|
will cause uninitialized rlimits that lead to unpredictable results
|
||||||
|
when Finit later tries to start the run/task/service.
|
||||||
|
|
||||||
* `HOOK_NETWORK_UP`, `hook/net/up`: System bootstrap, runlevel S, has
|
* `HOOK_NETWORK_UP`, `hook/net/up`: System bootstrap, runlevel S, has
|
||||||
completed and networking is up (`lo` is up and the `network` script
|
completed and networking is up (`lo` is up and the `network` script
|
||||||
has run)
|
has run)
|
||||||
|
|||||||
+2
-5
@@ -163,11 +163,8 @@ static void setup(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = __FILE__,
|
||||||
.hook[HOOK_BASEFS_UP] = {
|
.hook[HOOK_SVC_PLUGIN] = { .cb = setup },
|
||||||
.cb = setup
|
|
||||||
},
|
|
||||||
.depends = { "bootmisc", },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PLUGIN_INIT(plugin_init)
|
PLUGIN_INIT(plugin_init)
|
||||||
|
|||||||
+2
-5
@@ -91,11 +91,8 @@ static void setup(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = __FILE__,
|
||||||
.hook[HOOK_BASEFS_UP] = {
|
.hook[HOOK_SVC_PLUGIN] = { .cb = setup },
|
||||||
.cb = setup
|
|
||||||
},
|
|
||||||
.depends = { "bootmisc", "modprobe" },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PLUGIN_INIT(plugin_init)
|
PLUGIN_INIT(plugin_init)
|
||||||
|
|||||||
@@ -212,10 +212,8 @@ static void load(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static plugin_t plugin = {
|
static plugin_t plugin = {
|
||||||
.name = __FILE__,
|
.name = __FILE__,
|
||||||
.hook[HOOK_BASEFS_UP] = {
|
.hook[HOOK_SVC_PLUGIN] = { .cb = load },
|
||||||
.cb = load
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PLUGIN_INIT(plugin_init)
|
PLUGIN_INIT(plugin_init)
|
||||||
|
|||||||
@@ -1209,6 +1209,9 @@ int conf_init(uev_ctx_t *ctx)
|
|||||||
/* Initialize global rlimits, e.g. for built-in services */
|
/* Initialize global rlimits, e.g. for built-in services */
|
||||||
memcpy(global_rlimit, initial_rlimit, sizeof(global_rlimit));
|
memcpy(global_rlimit, initial_rlimit, sizeof(global_rlimit));
|
||||||
|
|
||||||
|
dbg("Allow plugins to register early runlevel 1 run/task/services ...");
|
||||||
|
plugin_run_hooks(HOOK_SVC_PLUGIN);
|
||||||
|
|
||||||
/* Read global rlimits and global cgroup setup from /etc/finit.conf */
|
/* Read global rlimits and global cgroup setup from /etc/finit.conf */
|
||||||
parse_conf(finit_conf, 0);
|
parse_conf(finit_conf, 0);
|
||||||
|
|
||||||
|
|||||||
+8
-7
@@ -476,6 +476,9 @@ static void fs_mount_all(void)
|
|||||||
|
|
||||||
dbg("Finalize, ensure common file systems are available ...");
|
dbg("Finalize, ensure common file systems are available ...");
|
||||||
fs_finalize();
|
fs_finalize();
|
||||||
|
|
||||||
|
dbg("Base FS up, calling hooks ...");
|
||||||
|
plugin_run_hooks(HOOK_BASEFS_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -789,7 +792,11 @@ int main(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
fs_mount_all();
|
fs_mount_all();
|
||||||
|
|
||||||
/* Bootstrap conditions, needed for hooks */
|
/*
|
||||||
|
* Base FS up, enable standard SysV init signals and
|
||||||
|
* Bootstrap conditions, needed for hooks
|
||||||
|
*/
|
||||||
|
sig_setup(&loop);
|
||||||
cond_init();
|
cond_init();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -821,12 +828,6 @@ int main(int argc, char *argv[])
|
|||||||
if (whichp(FINIT_LIBPATH_ "/keventd"))
|
if (whichp(FINIT_LIBPATH_ "/keventd"))
|
||||||
service_register(SVC_TYPE_SERVICE, "[123456789] cgroup.init " FINIT_LIBPATH_ "/keventd -- Finit kernel event daemon", global_rlimit, NULL);
|
service_register(SVC_TYPE_SERVICE, "[123456789] cgroup.init " FINIT_LIBPATH_ "/keventd -- Finit kernel event daemon", global_rlimit, NULL);
|
||||||
|
|
||||||
/* Base FS up, enable standard SysV init signals */
|
|
||||||
sig_setup(&loop);
|
|
||||||
|
|
||||||
dbg("Base FS up, calling hooks ...");
|
|
||||||
plugin_run_hooks(HOOK_BASEFS_UP);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set up inotify watcher for /etc/finit.conf, /etc/finit.d, and
|
* Set up inotify watcher for /etc/finit.conf, /etc/finit.d, and
|
||||||
* their deps, to figure out how to bootstrap the system.
|
* their deps, to figure out how to bootstrap the system.
|
||||||
|
|||||||
@@ -72,6 +72,7 @@
|
|||||||
CHOOSE(HOOK_MOUNT_ERROR, "hook/mount/error"), \
|
CHOOSE(HOOK_MOUNT_ERROR, "hook/mount/error"), \
|
||||||
CHOOSE(HOOK_MOUNT_POST, "hook/mount/post"), \
|
CHOOSE(HOOK_MOUNT_POST, "hook/mount/post"), \
|
||||||
CHOOSE(HOOK_BASEFS_UP, "hook/mount/all"), \
|
CHOOSE(HOOK_BASEFS_UP, "hook/mount/all"), \
|
||||||
|
CHOOSE(HOOK_SVC_PLUGIN, "hook/svc/plugin"), \
|
||||||
CHOOSE(HOOK_NETWORK_UP, "hook/net/up"), \
|
CHOOSE(HOOK_NETWORK_UP, "hook/net/up"), \
|
||||||
CHOOSE(HOOK_SVC_UP, "hook/svc/up"), \
|
CHOOSE(HOOK_SVC_UP, "hook/svc/up"), \
|
||||||
CHOOSE(HOOK_SYSTEM_UP, "hook/sys/up"), \
|
CHOOSE(HOOK_SYSTEM_UP, "hook/sys/up"), \
|
||||||
|
|||||||
Reference in new issue
Block a user