valeriyvdovin / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0730-core-Fix-edge-case-when-processing-proc-self-mountin.patch

Pablo Greco 48fc63
From 1c9add7cc78fc65b043f9e87ab63bb2158d2ddf0 Mon Sep 17 00:00:00 2001
Pablo Greco 48fc63
From: Kyle Walker <kwalker@redhat.com>
Pablo Greco 48fc63
Date: Thu, 21 Mar 2019 15:09:06 -0400
Pablo Greco 48fc63
Subject: [PATCH] core: Fix edge case when processing /proc/self/mountinfo
Pablo Greco 48fc63
Pablo Greco 48fc63
Currently, if there are two /proc/self/mountinfo entries with the same
Pablo Greco 48fc63
mount point path, the mount setup flags computed for the second of
Pablo Greco 48fc63
these two entries will overwrite the mount setup flags computed for
Pablo Greco 48fc63
the first of these two entries. This is the root cause of issue #7798.
Pablo Greco 48fc63
This patch changes mount_setup_existing_unit to prevent the
Pablo Greco 48fc63
just_mounted mount setup flag from being overwritten if it is set to
Pablo Greco 48fc63
true. This will allow all mount units created from /proc/self/mountinfo
Pablo Greco 48fc63
entries to be initialized properly.
Pablo Greco 48fc63
Pablo Greco 48fc63
(cherry picked from commit 65d36b49508a53e56bae9609ff00fdc3de340608)
Pablo Greco 48fc63
Pablo Greco 48fc63
Resolves: #1691511
Pablo Greco 48fc63
---
Pablo Greco 48fc63
 src/core/mount.c | 2 +-
Pablo Greco 48fc63
 1 file changed, 1 insertion(+), 1 deletion(-)
Pablo Greco 48fc63
Pablo Greco 48fc63
diff --git a/src/core/mount.c b/src/core/mount.c
Pablo Greco 48fc63
index 5fd7a86ddd..c7aed2333f 100644
Pablo Greco 48fc63
--- a/src/core/mount.c
Pablo Greco 48fc63
+++ b/src/core/mount.c
Pablo Greco 48fc63
@@ -1527,7 +1527,7 @@ static int mount_setup_unit(
Pablo Greco 48fc63
 
Pablo Greco 48fc63
         if (set_flags) {
Pablo Greco 48fc63
                 MOUNT(u)->is_mounted = true;
Pablo Greco 48fc63
-                MOUNT(u)->just_mounted = !MOUNT(u)->from_proc_self_mountinfo;
Pablo Greco 48fc63
+                MOUNT(u)->just_mounted = !MOUNT(u)->from_proc_self_mountinfo || MOUNT(u)->just_mounted;
Pablo Greco 48fc63
                 MOUNT(u)->just_changed = changed;
Pablo Greco 48fc63
         }
Pablo Greco 48fc63