diff options
author | Dimitri Staessens <[email protected]> | 2021-07-05 21:09:50 +0200 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2021-07-10 16:35:01 +0200 |
commit | 7613c50332469146838cdc524ecee40b3f379322 (patch) | |
tree | 0e2528838ca18d4bcbb21a2fc1a5c2580064eb58 | |
parent | 7c0c62706f2ae9821dc779db268a28ef986730fe (diff) | |
download | ouroboros-7613c50332469146838cdc524ecee40b3f379322.tar.gz ouroboros-7613c50332469146838cdc524ecee40b3f379322.zip |
lib: Don't initialize process RIB for IPCPs
This will skip rib_init() at __init() for IPCPs (or at least,
processes that have "ipcpd" in the executable name). The previous code
tried to unmount the generic mount and then remount under the ipcp
name, but it often failed because fuse_mount() is asynchronous and the
mount was not up at the time of the unmount() call. Renaming the mount
instead of unmounting failed for the same reason. This is a better
fix for now.
Signed-off-by: Dimitri Staessens <[email protected]>
Signed-off-by: Sander Vrijders <[email protected]>
-rw-r--r-- | src/lib/dev.c | 8 | ||||
-rw-r--r-- | src/lib/rib.c | 7 |
2 files changed, 5 insertions, 10 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c index fbbc096d..723e3350 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -443,9 +443,11 @@ static void init(int argc, goto fail_timerwheel; #if defined PROC_FLOW_STATS - sprintf(procstr, "proc.%d", getpid()); - /* Don't bail, it just won't show metrics */ - rib_init(procstr); + if (strstr(argv[0], "ipcpd") == NULL) { + sprintf(procstr, "proc.%d", getpid()); + /* Don't bail on fail, it just won't show metrics */ + rib_init(procstr); + } #endif return; diff --git a/src/lib/rib.c b/src/lib/rib.c index 8fda19d4..27c66f2f 100644 --- a/src/lib/rib.c +++ b/src/lib/rib.c @@ -29,7 +29,6 @@ #include <ouroboros/rib.h> #include <ouroboros/utils.h> - #include <assert.h> #include <pthread.h> #include <stdio.h> @@ -292,12 +291,6 @@ int rib_init(const char * mountpt) if (stat(FUSE_PREFIX, &st) == -1) goto fail; - /* This is crap to allow IPCP RIB to remount to a different name */ - if (strlen(rib.mnt) > 0) { - fuse_unmount(rib.mnt, rib.ch); - rmdir(rib.mnt); - } - sprintf(rib.mnt, FUSE_PREFIX "/%s", mountpt); if (stat(rib.mnt, &st) == -1) |