d24108b9c9
- Add several upstream bugfix patches which are missed: * 0018-core-do-not-add-what-to-RequiresMountsFor-for-networ.patch * 0026-udevadm.xml-document-resolve-names-option-for-test.patch * 0030-Fix-for-SIGSEGV-in-systemd-bootchart-on-short-living.patch * 0032-rules-don-t-limit-some-of-the-rules-to-the-add-actio.patch * 0031-man-document-the-b-special-boot-option.patch * 0033-tmpfiles-log-unaccessible-FUSE-mount-points-only-as-.patch * 0034-systemd-python-fix-booted-and-add-two-functions-to-d.patch * 0035-activate-mention-E-in-the-help-text.patch * 0036-activate-fix-crash-when-s-is-passed.patch * 0037-tmpfiles-adjust-excludes-for-the-new-per-service-pri.patch * 0038-core-socket-fix-SO_REUSEPORT.patch * 0039-journal-when-appending-to-journal-file-allocate-larg.patch * 0040-journal-optimize-bisection-logic-a-bit-by-caching-th.patch * 0041-journal-fix-iteration-when-we-go-backwards-from-the-.patch * 0042-journal-allow-journal_file_copy_entry-to-work-on-non.patch * 0043-journal-simplify-pre-allocation-logic.patch * 0044-journald-mention-how-long-we-needed-to-flush-to-var-.patch * 0046-util.c-check-if-return-value-from-ttyname_r-is-0-ins.patch * 0047-docs-remove-unneeded-the-s-in-gudev-docs.patch * 0048-man-explicitly-say-when-multiple-units-can-be-specif.patch * 0049-systemd-treat-reload-failure-as-failure.patch - Add patch 0001-Don-t-snprintf-a-potentially-NULL-pointer.patch to avoid potential NULL pointer - Reorder patches to reflect udev/systemd usage - don't build bash-completions for bootstrap package - add more requires to this-is-only-for-build-envs to avoid problems in kiwi configs OBS-URL: https://build.opensuse.org/request/show/222383 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=176
182 lines
5.0 KiB
Diff
182 lines
5.0 KiB
Diff
From fc676b00a7545743429e0c9b12a0f0707b1059aa Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Date: Sat, 5 Oct 2013 13:09:43 -0400
|
|
Subject: [PATCH] core: do not add "what" to RequiresMountsFor for network
|
|
mounts
|
|
|
|
For cifs mount like //server/share, we would get
|
|
RequiresMountsFor=/server/share, which probably isn't
|
|
harmful, but quite confusing.
|
|
|
|
Unfortunately a bunch of static functions had to be moved
|
|
up, but patch is really one line.
|
|
---
|
|
src/core/mount.c | 137 ++++++++++++++++++++++++++++--------------------------
|
|
1 file changed, 70 insertions(+), 67 deletions(-)
|
|
|
|
diff --git src/core/mount.c src/core/mount.c
|
|
index db055f0..70cd372 100644
|
|
--- src/core/mount.c
|
|
+++ src/core/mount.c
|
|
@@ -59,6 +59,72 @@ static const UnitActiveState state_translation_table[_MOUNT_STATE_MAX] = {
|
|
[MOUNT_FAILED] = UNIT_FAILED
|
|
};
|
|
|
|
+static char* mount_test_option(const char *haystack, const char *needle) {
|
|
+ struct mntent me = { .mnt_opts = (char*) haystack };
|
|
+
|
|
+ assert(needle);
|
|
+
|
|
+ /* Like glibc's hasmntopt(), but works on a string, not a
|
|
+ * struct mntent */
|
|
+
|
|
+ if (!haystack)
|
|
+ return NULL;
|
|
+
|
|
+ return hasmntopt(&me, needle);
|
|
+}
|
|
+
|
|
+static bool mount_is_network(MountParameters *p) {
|
|
+ assert(p);
|
|
+
|
|
+ if (mount_test_option(p->options, "_netdev"))
|
|
+ return true;
|
|
+
|
|
+ if (p->fstype && fstype_is_network(p->fstype))
|
|
+ return true;
|
|
+
|
|
+ return false;
|
|
+}
|
|
+
|
|
+static bool mount_is_bind(MountParameters *p) {
|
|
+ assert(p);
|
|
+
|
|
+ if (mount_test_option(p->options, "bind"))
|
|
+ return true;
|
|
+
|
|
+ if (p->fstype && streq(p->fstype, "bind"))
|
|
+ return true;
|
|
+
|
|
+ if (mount_test_option(p->options, "rbind"))
|
|
+ return true;
|
|
+
|
|
+ if (p->fstype && streq(p->fstype, "rbind"))
|
|
+ return true;
|
|
+
|
|
+ return false;
|
|
+}
|
|
+
|
|
+static bool mount_is_auto(MountParameters *p) {
|
|
+ assert(p);
|
|
+
|
|
+ return !mount_test_option(p->options, "noauto");
|
|
+}
|
|
+
|
|
+static bool needs_quota(MountParameters *p) {
|
|
+ assert(p);
|
|
+
|
|
+ if (mount_is_network(p))
|
|
+ return false;
|
|
+
|
|
+ if (mount_is_bind(p))
|
|
+ return false;
|
|
+
|
|
+ return mount_test_option(p->options, "usrquota") ||
|
|
+ mount_test_option(p->options, "grpquota") ||
|
|
+ mount_test_option(p->options, "quota") ||
|
|
+ mount_test_option(p->options, "usrjquota") ||
|
|
+ mount_test_option(p->options, "grpjquota");
|
|
+}
|
|
+
|
|
static void mount_init(Unit *u) {
|
|
Mount *m = MOUNT(u);
|
|
|
|
@@ -182,7 +248,10 @@ static int mount_add_mount_links(Mount *m) {
|
|
* for the source path (if this is a bind mount) to be
|
|
* available. */
|
|
pm = get_mount_parameters_fragment(m);
|
|
- if (pm && pm->what && path_is_absolute(pm->what)) {
|
|
+ if (pm && pm->what &&
|
|
+ path_is_absolute(pm->what) &&
|
|
+ !mount_is_network(pm)) {
|
|
+
|
|
r = unit_require_mounts_for(UNIT(m), pm->what);
|
|
if (r < 0)
|
|
return r;
|
|
@@ -214,72 +283,6 @@ static int mount_add_mount_links(Mount *m) {
|
|
return 0;
|
|
}
|
|
|
|
-static char* mount_test_option(const char *haystack, const char *needle) {
|
|
- struct mntent me = { .mnt_opts = (char*) haystack };
|
|
-
|
|
- assert(needle);
|
|
-
|
|
- /* Like glibc's hasmntopt(), but works on a string, not a
|
|
- * struct mntent */
|
|
-
|
|
- if (!haystack)
|
|
- return NULL;
|
|
-
|
|
- return hasmntopt(&me, needle);
|
|
-}
|
|
-
|
|
-static bool mount_is_network(MountParameters *p) {
|
|
- assert(p);
|
|
-
|
|
- if (mount_test_option(p->options, "_netdev"))
|
|
- return true;
|
|
-
|
|
- if (p->fstype && fstype_is_network(p->fstype))
|
|
- return true;
|
|
-
|
|
- return false;
|
|
-}
|
|
-
|
|
-static bool mount_is_bind(MountParameters *p) {
|
|
- assert(p);
|
|
-
|
|
- if (mount_test_option(p->options, "bind"))
|
|
- return true;
|
|
-
|
|
- if (p->fstype && streq(p->fstype, "bind"))
|
|
- return true;
|
|
-
|
|
- if (mount_test_option(p->options, "rbind"))
|
|
- return true;
|
|
-
|
|
- if (p->fstype && streq(p->fstype, "rbind"))
|
|
- return true;
|
|
-
|
|
- return false;
|
|
-}
|
|
-
|
|
-static bool mount_is_auto(MountParameters *p) {
|
|
- assert(p);
|
|
-
|
|
- return !mount_test_option(p->options, "noauto");
|
|
-}
|
|
-
|
|
-static bool needs_quota(MountParameters *p) {
|
|
- assert(p);
|
|
-
|
|
- if (mount_is_network(p))
|
|
- return false;
|
|
-
|
|
- if (mount_is_bind(p))
|
|
- return false;
|
|
-
|
|
- return mount_test_option(p->options, "usrquota") ||
|
|
- mount_test_option(p->options, "grpquota") ||
|
|
- mount_test_option(p->options, "quota") ||
|
|
- mount_test_option(p->options, "usrjquota") ||
|
|
- mount_test_option(p->options, "grpjquota");
|
|
-}
|
|
-
|
|
static int mount_add_device_links(Mount *m) {
|
|
MountParameters *p;
|
|
bool device_wants_mount = false;
|
|
--
|
|
1.7.9.2
|
|
|