[systemd/f15] Fix quota (#773431)

Michal Schmidt michich at fedoraproject.org
Tue Jan 31 13:42:12 UTC 2012


commit 365e939f72858bb24fbe5fc7cd367e7cdaa0e8e7
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Tue Jan 31 14:38:02 2012 +0100

    Fix quota (#773431)

 0001-mount-fix-automount-regression.patch |   42 +++++++++++++++
 0001-mount-fix-quota.patch                |   79 +++++++++++++++++++++++++++++
 2 files changed, 121 insertions(+), 0 deletions(-)
---
diff --git a/0001-mount-fix-automount-regression.patch b/0001-mount-fix-automount-regression.patch
new file mode 100644
index 0000000..e318157
--- /dev/null
+++ b/0001-mount-fix-automount-regression.patch
@@ -0,0 +1,42 @@
+From da375869ff31f83938123dc0d2a8d5c0f0845a0c Mon Sep 17 00:00:00 2001
+From: Michal Schmidt <mschmidt at redhat.com>
+Date: Thu, 26 Jan 2012 01:19:19 +0100
+Subject: [PATCH] mount: fix automount regression
+
+Tom Gundersen noticed a regression where comment=systemd.automount in
+fstab no longer prevented the adding of the After=foo.mount dependency
+into local-fs.target. He bisected it to commit 9ddc4a26.
+
+It turns out that clearing the default_dependencies flag is necessary
+after all, in order to avoid complementing of Wants= with After= in the
+target unit. We still want to add the dependencies on quota units and
+umount.target though.
+---
+ src/mount.c |    7 ++++++-
+ 1 files changed, 6 insertions(+), 1 deletions(-)
+
+Index: systemd-26/src/mount.c
+===================================================================
+--- systemd-26.orig/src/mount.c
++++ systemd-26/src/mount.c
+@@ -590,6 +590,11 @@ static int mount_load(Unit *u) {
+ 
+                 if (m->meta.fragment_path)
+                         m->from_fragment = true;
++                else if (m->from_etc_fstab)
++                        /* We always add several default dependencies to fstab mounts,
++                         * but we do not want the implicit complementing of Wants= with After=
++                         * in the target unit that this mount unit will be hooked into. */
++                        m->meta.default_dependencies = false;
+ 
+                 if (!m->where)
+                         if (!(m->where = unit_name_to_path(u->meta.id)))
+@@ -622,7 +627,7 @@ static int mount_load(Unit *u) {
+                 if ((r = mount_add_fstab_links(m)) < 0)
+                         return r;
+ 
+-                if (m->meta.default_dependencies)
++                if (m->meta.default_dependencies || m->from_etc_fstab)
+                         if ((r = mount_add_default_dependencies(m)) < 0)
+                                 return r;
+ 
diff --git a/0001-mount-fix-quota.patch b/0001-mount-fix-quota.patch
new file mode 100644
index 0000000..b0a2d12
--- /dev/null
+++ b/0001-mount-fix-quota.patch
@@ -0,0 +1,79 @@
+From 9ddc4a26e56b06cd7774a03597980351855d8d54 Mon Sep 17 00:00:00 2001
+From: Michal Schmidt <mschmidt at redhat.com>
+Date: Fri, 13 Jan 2012 23:55:28 +0100
+Subject: [PATCH] mount: fix quota
+
+quotacheck.service and quotaon.service were not pulled in for fstab mounts.
+Fix it by not clearing the default_dependencies flag.
+
+The root filesystem may have quotas too, so don't check for "/" there.
+
+No need to have duplicate code for adding dependencies on umount.target.
+
+https://bugzilla.redhat.com/show_bug.cgi?id=773431
+---
+ src/mount.c |   27 ++++++++++-----------------
+ 1 files changed, 10 insertions(+), 17 deletions(-)
+
+diff --git a/src/mount.c b/src/mount.c
+index f72c50a..12c0710 100644
+--- a/src/mount.c
++++ b/src/mount.c
+@@ -357,10 +357,6 @@ static int mount_add_fstab_links(Mount *m) {
+                 after = SPECIAL_LOCAL_FS_PRE_TARGET;
+         }
+ 
+-        if (!path_equal(m->where, "/"))
+-                if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
+-                        return r;
+-
+         if ((r = manager_load_unit(m->meta.manager, target, NULL, NULL, &tu)) < 0)
+                 return r;
+ 
+@@ -461,24 +457,23 @@ static int mount_add_device_links(Mount *m) {
+ 
+ static int mount_add_default_dependencies(Mount *m) {
+         int r;
++        MountParameters *p;
+ 
+         assert(m);
+ 
+-        if (m->meta.manager->running_as == MANAGER_SYSTEM &&
+-            !path_equal(m->where, "/")) {
+-                MountParameters *p;
+-
+-                p = get_mount_parameters_configured(m);
++        if (m->meta.manager->running_as != MANAGER_SYSTEM)
++                return 0;
+ 
+-                if (p && needs_quota(p)) {
+-                        if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_WANTS, SPECIAL_QUOTACHECK_SERVICE, NULL, true)) < 0 ||
+-                            (r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_WANTS, SPECIAL_QUOTAON_SERVICE, NULL, true)) < 0)
+-                                return r;
+-                }
++        p = get_mount_parameters_configured(m);
++        if (p && needs_quota(p)) {
++                if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_WANTS, SPECIAL_QUOTACHECK_SERVICE, NULL, true)) < 0 ||
++                    (r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_WANTS, SPECIAL_QUOTAON_SERVICE, NULL, true)) < 0)
++                        return r;
++        }
+ 
++        if (!path_equal(m->where, "/"))
+                 if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
+                         return r;
+-        }
+ 
+         return 0;
+ }
+@@ -588,8 +583,6 @@ static int mount_load(Unit *u) {
+ 
+                 if (m->meta.fragment_path)
+                         m->from_fragment = true;
+-                else if (m->from_etc_fstab)
+-                        m->meta.default_dependencies = false;
+ 
+                 if (!m->where)
+                         if (!(m->where = unit_name_to_path(u->meta.id)))
+-- 
+1.7.7.6
+


More information about the scm-commits mailing list