summaryrefslogtreecommitdiff
path: root/src/hibernate-resume
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-12-03 17:04:26 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-12-03 17:20:19 +0100
commitff757c9d294153a26a9dd2d9817d1985656f3002 (patch)
tree489a31f70925528f37c8a57309ce7a29e4ecf899 /src/hibernate-resume
parent7cecc563163f539c497ecdf5ab00729fcd8c97c1 (diff)
downloadsystemd-ff757c9d294153a26a9dd2d9817d1985656f3002.tar.gz
hibernate-resume-generator: wait "infinitely" for the resume device
This makes changes similar to the parent commit, but for hibernate-resume-generator. If resume= is specified on the kernel command line, we'll set JobRunningTimeoutSec=0 for the device. This matches what we do for the root device. In practice, other timeouts will take effect. For example dracut tries (and fails :[ ) to start dracut-emergency.service after some time. Fixes #7242, https://bugzilla.redhat.com/show_bug.cgi?id=1705522.
Diffstat (limited to 'src/hibernate-resume')
-rw-r--r--src/hibernate-resume/hibernate-resume-generator.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/hibernate-resume/hibernate-resume-generator.c b/src/hibernate-resume/hibernate-resume-generator.c
index 3f49f564d6..5e40933fdf 100644
--- a/src/hibernate-resume/hibernate-resume-generator.c
+++ b/src/hibernate-resume/hibernate-resume-generator.c
@@ -5,6 +5,7 @@
#include <unistd.h>
#include "alloc-util.h"
+#include "dropin.h"
#include "fstab-util.h"
#include "generator.h"
#include "log.h"
@@ -68,18 +69,18 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
}
static int process_resume(void) {
- _cleanup_free_ char *name = NULL, *lnk = NULL;
- const char *opts;
+ _cleanup_free_ char *service_unit = NULL, *device_unit = NULL, *lnk = NULL;
int r;
if (!arg_resume_device)
return 0;
- r = unit_name_from_path_instance("systemd-hibernate-resume", arg_resume_device, ".service", &name);
+ r = unit_name_from_path_instance("systemd-hibernate-resume", arg_resume_device, ".service",
+ &service_unit);
if (r < 0)
return log_error_errno(r, "Failed to generate unit name: %m");
- lnk = strjoin(arg_dest, "/" SPECIAL_SYSINIT_TARGET ".wants/", name);
+ lnk = strjoin(arg_dest, "/" SPECIAL_SYSINIT_TARGET ".wants/", service_unit);
if (!lnk)
return log_oom();
@@ -87,12 +88,21 @@ static int process_resume(void) {
if (symlink(SYSTEM_DATA_UNIT_PATH "/systemd-hibernate-resume@.service", lnk) < 0)
return log_error_errno(errno, "Failed to create symlink %s: %m", lnk);
- if (arg_resume_options)
- opts = arg_resume_options;
- else
- opts = arg_root_options;
+ r = unit_name_from_path(arg_resume_device, ".device", &device_unit);
+ if (r < 0)
+ return log_error_errno(r, "Failed to generate unit name: %m");
+
+ r = write_drop_in(arg_dest, device_unit, 40, "device-timeout",
+ "# Automatically generated by systemd-cryptsetup-generator\n\n"
+ "[Unit]\nJobTimeoutSec=0");
+ if (r < 0)
+ log_warning_errno(r, "Failed to write device timeout drop-in: %m");
- r = generator_write_timeouts(arg_dest, arg_resume_device, arg_resume_device, opts, NULL);
+ r = generator_write_timeouts(arg_dest,
+ arg_resume_device,
+ arg_resume_device,
+ arg_resume_options ?: arg_root_options,
+ NULL);
if (r < 0)
return r;