aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Oberritter <obi@opendreambox.org>2017-01-23 22:51:01 +0100
committerAndreas Oberritter <obi@opendreambox.org>2017-10-17 04:38:27 +0200
commitc493af6a47a584a6b1819b5bc4aec90a967809c8 (patch)
treecd229b2b83e3fe08c94b45ff3df7983550161759
parentabfcb33b2679684656cf9bf573078db38c3433ec (diff)
downloadopenembedded-core-contrib-c493af6a47a584a6b1819b5bc4aec90a967809c8.tar.gz
systemd: backport fixes for automount
Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
-rw-r--r--meta/recipes-core/systemd/systemd/0023-automount-handle-expire_tokens-when-the-mount-unit-c.patch52
-rw-r--r--meta/recipes-core/systemd/systemd/0024-automount-don-t-cancel-mount-umount-request-on-reloa.patch42
-rw-r--r--meta/recipes-core/systemd/systemd/0025-automount-make-sure-the-expire-event-is-restarted-af.patch36
-rw-r--r--meta/recipes-core/systemd/systemd_230.bb3
4 files changed, 133 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/0023-automount-handle-expire_tokens-when-the-mount-unit-c.patch b/meta/recipes-core/systemd/systemd/0023-automount-handle-expire_tokens-when-the-mount-unit-c.patch
new file mode 100644
index 0000000000..dcfc7cf05c
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0023-automount-handle-expire_tokens-when-the-mount-unit-c.patch
@@ -0,0 +1,52 @@
+From 0134f783bbe07a32795778f177d1b73b10c4c8a7 Mon Sep 17 00:00:00 2001
+From: michaelolbrich <m.olbrich@pengutronix.de>
+Date: Sun, 5 Jun 2016 17:25:14 +0200
+Subject: [PATCH] automount: handle expire_tokens when the mount unit changes
+ its state (#3434)
+
+This basically reverts 7b2fd9d51259f6cf350791434e640ac3519acc6c ("core:
+remove duplicate code in automount_update_mount()").
+
+This was not duplicate code. The expire_tokens need to be handled as well:
+Send 0 == success for MOUNT_DEAD (umount successful), do nothing for
+MOUNT_UNMOUNTING (not yet done) and an error for everything else.
+
+Otherwise the automount logic will assume unmounting is not done and will
+not send any new requests for mounting. As a result, the corresponding
+mount unit is never mounted.
+
+Without this, automounts with TimeoutIdleSec= are broken. Once the idle
+timeout triggered a umount, any access to the corresponding filesystem
+hangs forever.
+
+Fixes #3332.
+(cherry picked from commit 0a62f81045dd810c8f1223cccbac4d706ea2cb45)
+---
+ src/core/automount.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/src/core/automount.c b/src/core/automount.c
+index f06d837..85803a9 100644
+--- a/src/core/automount.c
++++ b/src/core/automount.c
+@@ -502,6 +502,20 @@ static void automount_trigger_notify(Unit *u, Unit *other) {
+ automount_set_state(a, AUTOMOUNT_RUNNING);
+ }
+
++ if (IN_SET(MOUNT(other)->state,
++ MOUNT_MOUNTING, MOUNT_MOUNTING_DONE,
++ MOUNT_MOUNTED, MOUNT_REMOUNTING,
++ MOUNT_MOUNTING_SIGTERM, MOUNT_MOUNTING_SIGKILL,
++ MOUNT_REMOUNTING_SIGTERM, MOUNT_REMOUNTING_SIGKILL,
++ MOUNT_UNMOUNTING_SIGTERM, MOUNT_UNMOUNTING_SIGKILL,
++ MOUNT_FAILED)) {
++
++ (void) automount_send_ready(a, a->expire_tokens, -ENODEV);
++ }
++
++ if (MOUNT(other)->state == MOUNT_DEAD)
++ (void) automount_send_ready(a, a->expire_tokens, 0);
++
+ /* The mount is in some unhappy state now, let's unfreeze any waiting clients */
+ if (IN_SET(MOUNT(other)->state,
+ MOUNT_DEAD, MOUNT_UNMOUNTING,
diff --git a/meta/recipes-core/systemd/systemd/0024-automount-don-t-cancel-mount-umount-request-on-reloa.patch b/meta/recipes-core/systemd/systemd/0024-automount-don-t-cancel-mount-umount-request-on-reloa.patch
new file mode 100644
index 0000000000..f39cd510ab
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0024-automount-don-t-cancel-mount-umount-request-on-reloa.patch
@@ -0,0 +1,42 @@
+From a66ec9b78e1314d54fa746e59311c328da6058bb Mon Sep 17 00:00:00 2001
+From: Michael Olbrich <m.olbrich@pengutronix.de>
+Date: Mon, 25 Jul 2016 20:04:02 +0200
+Subject: [PATCH] automount: don't cancel mount/umount request on reload/reexec
+ (#3670)
+
+All pending tokens are already serialized correctly and will be handled
+when the mount unit is done.
+
+Without this a 'daemon-reload' cancels all pending tokens. Any process
+waiting for the mount will continue with EHOSTDOWN.
+This can happen when the mount unit waits for it's dependencies, e.g.
+network, devices, fsck, etc.
+(cherry picked from commit 87d41d6244f1eaf441769f7f6216a606c52b8e89)
+---
+ src/core/automount.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/core/automount.c b/src/core/automount.c
+index 85803a9..4e98915 100644
+--- a/src/core/automount.c
++++ b/src/core/automount.c
+@@ -98,9 +98,6 @@ static void unmount_autofs(Automount *a) {
+ if (a->pipe_fd < 0)
+ return;
+
+- automount_send_ready(a, a->tokens, -EHOSTDOWN);
+- automount_send_ready(a, a->expire_tokens, -EHOSTDOWN);
+-
+ a->pipe_event_source = sd_event_source_unref(a->pipe_event_source);
+ a->pipe_fd = safe_close(a->pipe_fd);
+
+@@ -109,6 +106,9 @@ static void unmount_autofs(Automount *a) {
+ if (a->where &&
+ (UNIT(a)->manager->exit_code != MANAGER_RELOAD &&
+ UNIT(a)->manager->exit_code != MANAGER_REEXECUTE)) {
++ automount_send_ready(a, a->tokens, -EHOSTDOWN);
++ automount_send_ready(a, a->expire_tokens, -EHOSTDOWN);
++
+ r = repeat_unmount(a->where, MNT_DETACH);
+ if (r < 0)
+ log_error_errno(r, "Failed to unmount: %m");
diff --git a/meta/recipes-core/systemd/systemd/0025-automount-make-sure-the-expire-event-is-restarted-af.patch b/meta/recipes-core/systemd/systemd/0025-automount-make-sure-the-expire-event-is-restarted-af.patch
new file mode 100644
index 0000000000..a438970949
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0025-automount-make-sure-the-expire-event-is-restarted-af.patch
@@ -0,0 +1,36 @@
+From 2844ad491050ca301b7057ec15fb1202e0175469 Mon Sep 17 00:00:00 2001
+From: Michael Olbrich <m.olbrich@pengutronix.de>
+Date: Tue, 4 Oct 2016 16:13:27 +0200
+Subject: [PATCH] automount: make sure the expire event is restarted after a
+ daemon-reload (#4265)
+
+If the corresponding mount unit is deserialized after the automount unit
+then the expire event is set up in automount_trigger_notify(). However, if
+the mount unit is deserialized first then the automount unit is still in
+state AUTOMOUNT_DEAD and automount_trigger_notify() aborts without setting
+up the expire event.
+Explicitly call automount_start_expire() during coldplug to make sure that
+the expire event is set up as necessary.
+
+Fixes #4249.
+(cherry picked from commit c080fbce9ca4ac21d8dbb1c2d0e8c9205edfdbfb)
+---
+ src/core/automount.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/src/core/automount.c b/src/core/automount.c
+index 4e98915..a9d0d7a 100644
+--- a/src/core/automount.c
++++ b/src/core/automount.c
+@@ -271,6 +271,11 @@ static int automount_coldplug(Unit *u) {
+ return r;
+
+ (void) sd_event_source_set_description(a->pipe_event_source, "automount-io");
++ if (a->deserialized_state == AUTOMOUNT_RUNNING) {
++ r = automount_start_expire(a);
++ if (r < 0)
++ log_unit_warning_errno(UNIT(a), r, "Failed to start expiration timer, ignoring: %m");
++ }
+ }
+
+ automount_set_state(a, a->deserialized_state);
diff --git a/meta/recipes-core/systemd/systemd_230.bb b/meta/recipes-core/systemd/systemd_230.bb
index 3b44513626..b4140fca1e 100644
--- a/meta/recipes-core/systemd/systemd_230.bb
+++ b/meta/recipes-core/systemd/systemd_230.bb
@@ -35,6 +35,9 @@ SRC_URI += " \
file://0020-check-for-uchar.h-in-configure.patch \
file://0021-include-missing.h-for-getting-secure_getenv-definiti.patch \
file://0022-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch \
+ file://0023-automount-handle-expire_tokens-when-the-mount-unit-c.patch \
+ file://0024-automount-don-t-cancel-mount-umount-request-on-reloa.patch \
+ file://0025-automount-make-sure-the-expire-event-is-restarted-af.patch \
file://udev-re-enable-mount-propagation-for-udevd.patch \
file://CVE-2016-7795.patch \
"