dryang / rpms / systemd

Forked from rpms/systemd a year ago
Clone
Blob Blame History Raw
From 3b321e8bb1548432624b374f7077f4aaaae40a2d Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 26 Feb 2014 04:27:50 +0100
Subject: [PATCH] mount: don't send out PropertiesChanged message if actually
 nothing got changed

Conflicts:
	src/core/mount.c
---
 src/core/mount.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/core/mount.c b/src/core/mount.c
index c0445a6..62ec7fe 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1414,7 +1414,7 @@ static int mount_add_one(
                 bool set_flags) {
         int r;
         Unit *u;
-        bool delete;
+        bool delete, changed = false;;
         char *e, *w = NULL, *o = NULL, *f = NULL;
         MountParameters *p;
         bool load_extras = false;
@@ -1483,6 +1483,7 @@ static int mount_add_one(
                 }
 
                 unit_add_to_load_queue(u);
+                changed = true;
         } else {
                 delete = false;
                 free(e);
@@ -1502,6 +1503,7 @@ static int mount_add_one(
                         /* Load in the extras later on, after we
                          * finished initialization of the unit */
                         load_extras = true;
+                        changed = true;
                 }
         }
 
@@ -1513,10 +1515,16 @@ static int mount_add_one(
         }
 
         p = &MOUNT(u)->parameters_proc_self_mountinfo;
+
+        changed = changed ||
+                !streq_ptr(p->options, options) ||
+                !streq_ptr(p->what, what) ||
+                !streq_ptr(p->fstype, fstype);
+
         if (set_flags) {
                 MOUNT(u)->is_mounted = true;
                 MOUNT(u)->just_mounted = !MOUNT(u)->from_proc_self_mountinfo;
-                MOUNT(u)->just_changed = !streq_ptr(p->options, o);
+                MOUNT(u)->just_changed = changed;
         }
 
         MOUNT(u)->from_proc_self_mountinfo = true;
@@ -1538,7 +1546,8 @@ static int mount_add_one(
                         goto fail;
         }
 
-        unit_add_to_dbus_queue(u);
+        if (changed)
+                unit_add_to_dbus_queue(u);
 
         return 0;