job_add_to_run_queue(UNIT(other)->job);
}
-static int swap_coldplug(Unit *u) {
+static int swap_coldplug(Unit *u, Hashmap *deferred_work) {
Swap *s = SWAP(u);
SwapState new_state = SWAP_DEAD;
int r;
assert(c);
assert(_pid);
- unit_realize_cgroup(UNIT(s));
+ (void) unit_realize_cgroup(UNIT(s));
+ if (s->reset_cpu_usage) {
+ (void) unit_reset_cpu_usage(UNIT(s));
+ s->reset_cpu_usage = false;
+ }
r = unit_setup_exec_runtime(UNIT(s));
if (r < 0)
NULL, &discard, NULL);
priority = s->parameters_fragment.priority;
- if (priority < 0)
- fstab_find_pri(s->parameters_fragment.options, &priority);
+ if (priority < 0) {
+ r = fstab_find_pri(s->parameters_fragment.options, &priority);
+ if (r < 0)
+ log_notice_errno(r, "Failed to parse swap priority \"%s\", ignoring: %m",
+ s->parameters_fragment.options);
+ }
}
r = exec_command_set(s->control_command, "/sbin/swapon", NULL);
return -EAGAIN;
s->result = SWAP_SUCCESS;
+ s->reset_cpu_usage = true;
+
swap_enter_activating(s);
return 1;
}