Fix unintended restart of template siblings

Consider the case where container@.conf is an available template.  When
creating a container@foo.conf it will share the same base .conf as an
existing container@bar.conf, but we do not expect to restart bar just
because foo is instantiated.

Up until this change, all template siblings were considered "dirty" if a
new one was created or updated.  Skipping realpath() for all files that
have a '@' works around the problem.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2024-11-28 11:13:44 +01:00
parent d4889b435d
commit 465bc17ca4
+13 -7
View File
@@ -1432,16 +1432,22 @@ static int conf_change_act(char *dir, char *name, uint32_t mask)
strlcpy(fn, dir, sizeof(fn)); strlcpy(fn, dir, sizeof(fn));
dbg("path: %s mask: %08x", fn, mask); dbg("path: %s mask: %08x", fn, mask);
/* Handle disabling/removal of service */ if (strchr(name, '@')) {
rp = realpath(fn, NULL); /* Skip realpath for templates */
if (!rp) {
if (errno != ENOENT)
goto fail;
rp = strdup(fn); rp = strdup(fn);
if (!rp) } else {
goto fail; /* Handle disabling/removal of service */
rp = realpath(fn, NULL);
if (!rp) {
if (errno != ENOENT)
goto fail;
rp = strdup(fn);
}
} }
if (!rp)
goto fail;
node = conf_find(rp); node = conf_find(rp);
if (node) { if (node) {
dbg("event already registered for %s ...", name); dbg("event already registered for %s ...", name);