Zbigniew Jędrzejewski-Szmek 27bd1b
From b56c4c19c8d0adca67eb34e1924d881e7d61b97f Mon Sep 17 00:00:00 2001
Zbigniew Jędrzejewski-Szmek 27bd1b
From: =?UTF-8?q?Abd=C3=B3=20Roig-Maranges?= <abdo.roig@gmail.com>
Zbigniew Jędrzejewski-Szmek 27bd1b
Date: Mon, 31 Jul 2017 12:32:09 +0200
Zbigniew Jędrzejewski-Szmek 27bd1b
Subject: [PATCH] core: Do not fail perpetual mount units without fragment
Zbigniew Jędrzejewski-Szmek 27bd1b
 (#6459)
Zbigniew Jędrzejewski-Szmek 27bd1b
Zbigniew Jędrzejewski-Szmek 27bd1b
mount_load does not require fragment files to be present in order to
Zbigniew Jędrzejewski-Szmek 27bd1b
load mount units which are perpetual, or come from /proc/self/mountinfo.
Zbigniew Jędrzejewski-Szmek 27bd1b
Zbigniew Jędrzejewski-Szmek 27bd1b
mount_verify should do the same, otherwise a synthesized '-.mount' would
Zbigniew Jędrzejewski-Szmek 27bd1b
be marked as failed with "No such file or directory", as it is perpetual
Zbigniew Jędrzejewski-Szmek 27bd1b
but not marked to come from /proc/self/mountinfo at this point.
Zbigniew Jędrzejewski-Szmek 27bd1b
Zbigniew Jędrzejewski-Szmek 27bd1b
This happens for the user instance, and I suspect it was the cause of #5375
Zbigniew Jędrzejewski-Szmek 27bd1b
for the system instance, without gpt-generator.
Zbigniew Jędrzejewski-Szmek 27bd1b
Zbigniew Jędrzejewski-Szmek 27bd1b
(cherry picked from commit 1df96fcb31b3bc30c4a983de4734f61ed5a29115)
Zbigniew Jędrzejewski-Szmek 27bd1b
---
Zbigniew Jędrzejewski-Szmek 27bd1b
 src/core/mount.c | 2 +-
Zbigniew Jędrzejewski-Szmek 27bd1b
 1 file changed, 1 insertion(+), 1 deletion(-)
Zbigniew Jędrzejewski-Szmek 27bd1b
Zbigniew Jędrzejewski-Szmek 27bd1b
diff --git a/src/core/mount.c b/src/core/mount.c
Zbigniew Jędrzejewski-Szmek 27bd1b
index 214364d87d..7d9644e305 100644
Zbigniew Jędrzejewski-Szmek 27bd1b
--- a/src/core/mount.c
Zbigniew Jędrzejewski-Szmek 27bd1b
+++ b/src/core/mount.c
Zbigniew Jędrzejewski-Szmek 27bd1b
@@ -503,7 +503,7 @@ static int mount_verify(Mount *m) {
Zbigniew Jędrzejewski-Szmek 27bd1b
         if (UNIT(m)->load_state != UNIT_LOADED)
Zbigniew Jędrzejewski-Szmek 27bd1b
                 return 0;
Zbigniew Jędrzejewski-Szmek 27bd1b
 
Zbigniew Jędrzejewski-Szmek 27bd1b
-        if (!m->from_fragment && !m->from_proc_self_mountinfo)
Zbigniew Jędrzejewski-Szmek 27bd1b
+        if (!m->from_fragment && !m->from_proc_self_mountinfo && !UNIT(m)->perpetual)
Zbigniew Jędrzejewski-Szmek 27bd1b
                 return -ENOENT;
Zbigniew Jędrzejewski-Szmek 27bd1b
 
Zbigniew Jędrzejewski-Szmek 27bd1b
         r = unit_name_from_path(m->where, ".mount", &e);