b11b5f
From bb9d00035c00b8590c389e66b5d94334bbb7379d Mon Sep 17 00:00:00 2001
b11b5f
From: Franck Bui <fbui@suse.com>
b11b5f
Date: Mon, 30 Mar 2020 10:49:29 +0200
b11b5f
Subject: [PATCH] device: drop refuse_after
b11b5f
b11b5f
Scheduling devices after a given unit can be useful to start device *jobs* at a
b11b5f
specific time in the transaction, see commit 4195077ab4c823c.
b11b5f
b11b5f
This (hidden) change was introduced by commit eef85c4a3f8054d2.
b11b5f
b11b5f
(cherry picked from commit b862c25716520d9381d5a841dba0f0c14e9c970a)
b11b5f
b11b5f
[dtardon: This picks just the minimal relevant change from
b11b5f
c80a9a33d04fb4381327a69ce929c94a9f1d0e6c and
b11b5f
b862c25716520d9381d5a841dba0f0c14e9c970a]
b11b5f
b11b5f
Resolves: #2043524
b11b5f
---
b11b5f
 src/core/unit.c | 5 +++--
b11b5f
 1 file changed, 3 insertions(+), 2 deletions(-)
b11b5f
b11b5f
diff --git a/src/core/unit.c b/src/core/unit.c
b11b5f
index dfe0c243ef..9be2a0c326 100644
b11b5f
--- a/src/core/unit.c
b11b5f
+++ b/src/core/unit.c
b11b5f
@@ -2841,8 +2841,9 @@ int unit_add_dependency(
b11b5f
                 return 0;
b11b5f
         }
b11b5f
 
b11b5f
-        if ((d == UNIT_BEFORE && other->type == UNIT_DEVICE) ||
b11b5f
-            (d == UNIT_AFTER && u->type == UNIT_DEVICE)) {
b11b5f
+        /* Note that ordering a device unit after a unit is permitted since it
b11b5f
+         * allows to start its job running timeout at a specific time. */
b11b5f
+        if (d == UNIT_BEFORE && other->type == UNIT_DEVICE) {
b11b5f
                 log_unit_warning(u, "Dependency Before=%s ignored (.device units cannot be delayed)", other->id);
b11b5f
                 return 0;
b11b5f
         }