From: Lennart Poettering Date: Wed, 28 Nov 2018 19:23:32 +0000 (+0100) Subject: swap: when loading a unit from /proc/swaps, mark its load state as good X-Git-Tag: v240~112^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=46f944802ceb09641445f0cdfe28d3df44deea3f;p=thirdparty%2Fsystemd.git swap: when loading a unit from /proc/swaps, mark its load state as good This follows similar logic in the mount unit. --- diff --git a/src/core/swap.c b/src/core/swap.c index 8370414b79b..d91132fabd2 100644 --- a/src/core/swap.c +++ b/src/core/swap.c @@ -383,7 +383,6 @@ static int swap_setup_unit( return log_unit_error_errno(u, r, "Failed to generate unit name from path: %m"); u = manager_get_unit(m, e); - if (u && SWAP(u)->from_proc_swaps && !path_equal(SWAP(u)->parameters_proc_swaps.what, what_proc_swaps)) @@ -418,6 +417,13 @@ static int swap_setup_unit( } } + /* The unit is definitely around now, mark it as loaded if it was previously referenced but could not be + * loaded. After all we can load it now, from the data in /proc/swaps. */ + if (IN_SET(u->load_state, UNIT_NOT_FOUND, UNIT_BAD_SETTING, UNIT_ERROR)) { + u->load_state = UNIT_LOADED; + u->load_error = 0; + } + if (set_flags) { SWAP(u)->is_active = true; SWAP(u)->just_activated = !SWAP(u)->from_proc_swaps;