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