2022-10-11 09:32:44 +08:00
|
|
|
From 213ae9db6274227636fdca6731511499ed933e61 Mon Sep 17 00:00:00 2001
|
2022-04-18 16:27:03 +08:00
|
|
|
From: Geass-LL <shenxiaogll@163.com>
|
|
|
|
|
Date: Fri, 2 Apr 2021 11:27:59 +0800
|
|
|
|
|
Subject: [PATCH] unit: coldplug both job and nop_job if possible
|
|
|
|
|
|
|
|
|
|
Sometimes, both job and nop_job are deserialized. In this case,
|
|
|
|
|
if we only cold plug the job, the nop_job will also stuck in the
|
|
|
|
|
job list.
|
2022-10-11 09:32:44 +08:00
|
|
|
|
|
|
|
|
(cherry picked from commit 7dbd330c7ef28852db0fb044503ed6f072477d50)
|
|
|
|
|
|
|
|
|
|
Conflict:NA
|
|
|
|
|
Reference:https://github.com/systemd/systemd/commit/213ae9db6274227636fdca6731511499ed933e61
|
2022-04-18 16:27:03 +08:00
|
|
|
---
|
|
|
|
|
src/core/unit.c | 11 +++++++----
|
|
|
|
|
1 file changed, 7 insertions(+), 4 deletions(-)
|
|
|
|
|
|
|
|
|
|
diff --git a/src/core/unit.c b/src/core/unit.c
|
2022-10-11 09:32:44 +08:00
|
|
|
index e469beb534..38d3eb703f 100644
|
2022-04-18 16:27:03 +08:00
|
|
|
--- a/src/core/unit.c
|
|
|
|
|
+++ b/src/core/unit.c
|
2022-10-11 09:32:44 +08:00
|
|
|
@@ -3581,7 +3581,6 @@ int unit_add_blockdev_dependency(Unit *u, const char *what, UnitDependencyMask m
|
2022-04-18 16:27:03 +08:00
|
|
|
int unit_coldplug(Unit *u) {
|
|
|
|
|
int r = 0, q;
|
|
|
|
|
char **i;
|
|
|
|
|
- Job *uj;
|
|
|
|
|
|
|
|
|
|
assert(u);
|
|
|
|
|
|
2022-10-11 09:32:44 +08:00
|
|
|
@@ -3604,9 +3603,13 @@ int unit_coldplug(Unit *u) {
|
2022-04-18 16:27:03 +08:00
|
|
|
r = q;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- uj = u->job ?: u->nop_job;
|
|
|
|
|
- if (uj) {
|
|
|
|
|
- q = job_coldplug(uj);
|
|
|
|
|
+ if (u->job) {
|
|
|
|
|
+ q = job_coldplug(u->job);
|
|
|
|
|
+ if (q < 0 && r >= 0)
|
|
|
|
|
+ r = q;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (u->nop_job) {
|
|
|
|
|
+ q = job_coldplug(u->nop_job);
|
|
|
|
|
if (q < 0 && r >= 0)
|
|
|
|
|
r = q;
|
|
|
|
|
}
|
|
|
|
|
--
|
2022-10-11 09:32:44 +08:00
|
|
|
2.33.0
|
2022-04-18 16:27:03 +08:00
|
|
|
|