[systemd-commits] 2 commits - src/core

Michal Schmidt michich at kemper.freedesktop.org
Thu Jun 28 17:16:50 PDT 2012


 src/core/mount.c |  122 ++++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 81 insertions(+), 41 deletions(-)

New commits:
commit 8eba616fc09b854d13de5dacc5b31b1009c4e8d4
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Fri Jun 29 01:50:31 2012 +0200

    mount: load only if we there's mountinfo or fragment
    
    Having information from /proc/self/mountinfo is sufficient to consider a
    mount unit loaded.
    
    When there's no mountinfo, the loading of the fragment for the mount
    unit is not optional. No extra dependency links must be added when the
    loading fails.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=835848

diff --git a/src/core/mount.c b/src/core/mount.c
index 5364b5d..3d513a0 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -618,7 +618,11 @@ static int mount_load(Unit *u) {
         assert(u);
         assert(u->load_state == UNIT_STUB);
 
-        r = unit_load_fragment_and_dropin_optional(u);
+        if (m->from_proc_self_mountinfo)
+                r = unit_load_fragment_and_dropin_optional(u);
+        else
+                r = unit_load_fragment_and_dropin(u);
+
         if (r < 0)
                 return r;
 
@@ -1436,6 +1440,14 @@ static int mount_add_one(
         } else {
                 delete = false;
                 free(e);
+
+                if (u->load_state == UNIT_ERROR) {
+                        u->load_state = UNIT_LOADED;
+                        u->load_error = 0;
+                        r = mount_add_extras(MOUNT(u));
+                        if (r < 0)
+                                goto fail;
+                }
         }
 
         if (!(w = strdup(what)) ||

commit 1a4ac875003b49132c55a0ef36cd6ae2a15d3ac2
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Fri Jun 29 01:47:24 2012 +0200

    mount: split adding of extras from mount_load()

diff --git a/src/core/mount.c b/src/core/mount.c
index 6b35886..5364b5d 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -537,68 +537,96 @@ static int mount_verify(Mount *m) {
         return 0;
 }
 
-static int mount_load(Unit *u) {
-        Mount *m = MOUNT(u);
+static int mount_add_extras(Mount *m) {
+        Unit *u = UNIT(m);
         int r;
 
-        assert(u);
-        assert(u->load_state == UNIT_STUB);
-
-        if ((r = unit_load_fragment_and_dropin_optional(u)) < 0)
+        r = unit_add_exec_dependencies(u, &m->exec_context);
+        if (r < 0)
                 return r;
 
-        /* This is a new unit? Then let's add in some extras */
-        if (u->load_state == UNIT_LOADED) {
-                if ((r = unit_add_exec_dependencies(u, &m->exec_context)) < 0)
-                        return r;
-
-                if (UNIT(m)->fragment_path)
-                        m->from_fragment = true;
+        if (UNIT(m)->fragment_path)
+                m->from_fragment = true;
 
+        if (!m->where) {
+                m->where = unit_name_to_path(u->id);
                 if (!m->where)
-                        if (!(m->where = unit_name_to_path(u->id)))
-                                return -ENOMEM;
-
-                path_kill_slashes(m->where);
+                        return -ENOMEM;
+        }
 
-                if (!UNIT(m)->description)
-                        if ((r = unit_set_description(u, m->where)) < 0)
-                                return r;
+        path_kill_slashes(m->where);
 
-                if ((r = mount_add_device_links(m)) < 0)
+        if (!UNIT(m)->description) {
+                r = unit_set_description(u, m->where);
+                if (r < 0)
                         return r;
+        }
 
-                if ((r = mount_add_mount_links(m)) < 0)
-                        return r;
+        r = mount_add_device_links(m);
+        if (r < 0)
+                return r;
 
-                if ((r = mount_add_socket_links(m)) < 0)
-                        return r;
+        r = mount_add_mount_links(m);
+        if (r < 0)
+                return r;
 
-                if ((r = mount_add_swap_links(m)) < 0)
-                        return r;
+        r = mount_add_socket_links(m);
+        if (r < 0)
+                return r;
 
-                if ((r = mount_add_path_links(m)) < 0)
-                        return r;
+        r = mount_add_swap_links(m);
+        if (r < 0)
+                return r;
 
-                r = mount_add_requires_mounts_links(m);
-                if (r < 0)
-                        return r;
+        r = mount_add_path_links(m);
+        if (r < 0)
+                return r;
 
-                if ((r = mount_add_automount_links(m)) < 0)
-                        return r;
+        r = mount_add_requires_mounts_links(m);
+        if (r < 0)
+                return r;
+
+        r = mount_add_automount_links(m);
+        if (r < 0)
+                return r;
+
+        r = mount_add_quota_links(m);
+        if (r < 0)
+                return r;
 
-                r = mount_add_quota_links(m);
+        if (UNIT(m)->default_dependencies) {
+                r = mount_add_default_dependencies(m);
                 if (r < 0)
                         return r;
+        }
 
-                if (UNIT(m)->default_dependencies)
-                        if ((r = mount_add_default_dependencies(m)) < 0)
-                                return r;
+        r = unit_add_default_cgroups(u);
+        if (r < 0)
+                return r;
 
-                if ((r = unit_add_default_cgroups(u)) < 0)
-                        return r;
+        r = mount_fix_timeouts(m);
+        if (r < 0)
+                return r;
+
+        return 0;
+}
+
+static int mount_load(Unit *u) {
+        Mount *m = MOUNT(u);
+        int r;
+
+        assert(u);
+        assert(u->load_state == UNIT_STUB);
+
+        r = unit_load_fragment_and_dropin_optional(u);
+        if (r < 0)
+                return r;
 
-                mount_fix_timeouts(m);
+        /* This is a new unit? Then let's add in some extras */
+        if (u->load_state == UNIT_LOADED) {
+                r = mount_add_extras(m);
+                if (r < 0)
+                        return r;
         }
 
         return mount_verify(m);



More information about the systemd-commits mailing list