Blame SOURCES/0563-units-replace-remote-cryptsetup-pre.target-with-remo.patch

17b0f1
From 0d13caa0714c32af45165310e93f62c965f45b01 Mon Sep 17 00:00:00 2001
17b0f1
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
17b0f1
Date: Thu, 12 Oct 2017 22:34:54 +0200
17b0f1
Subject: [PATCH] units: replace remote-cryptsetup-pre.target with
17b0f1
 remote-fs-pre.target
17b0f1
17b0f1
remote-cryptsetup-pre.target was designed as an active unit (that pulls in
17b0f1
network-online.target), the opposite of remote-fs-pre.target (a passive unit,
17b0f1
with individual provider services ordering itself before it and pulling it in,
17b0f1
for example iscsi.service and nfs-client.target).
17b0f1
17b0f1
To make remote-cryptsetup-pre.target really work, those services should be
17b0f1
ordered before it too. But this would require updates to all those services,
17b0f1
not just changes from systemd side.
17b0f1
17b0f1
But the requirements for remote-fs-pre.target and remote-cryptset-pre.target
17b0f1
are fairly similar (e.g. iscsi devices can certainly be used for both), so
17b0f1
let's reuse remote-fs-pre.target also for remote cryptsetup units. This loses
17b0f1
a bit of flexibility, but does away with the requirement for various provider
17b0f1
services to know about remote-cryptsetup-pre.target.
17b0f1
17b0f1
Cherry-picked from: a0dd209763f9e67054ee322a2dfd52bccf345c2e
17b0f1
Resolves: #1477757
17b0f1
---
17b0f1
 Makefile.am                           |  3 +--
17b0f1
 man/crypttab.xml                      |  2 +-
17b0f1
 man/systemd.special.xml               | 20 ++++----------------
17b0f1
 src/cryptsetup/cryptsetup-generator.c |  2 +-
17b0f1
 units/remote-cryptsetup-pre.target    | 15 ---------------
17b0f1
 units/remote-cryptsetup.target        |  2 +-
17b0f1
 6 files changed, 8 insertions(+), 36 deletions(-)
17b0f1
 delete mode 100644 units/remote-cryptsetup-pre.target
17b0f1
17b0f1
diff --git a/Makefile.am b/Makefile.am
17b0f1
index 13c93f485e..f06bc29c25 100644
17b0f1
--- a/Makefile.am
17b0f1
+++ b/Makefile.am
17b0f1
@@ -4864,8 +4864,7 @@ systemgenerator_PROGRAMS += \
17b0f1
 dist_systemunit_DATA += \
17b0f1
 	units/cryptsetup.target \
17b0f1
 	units/cryptsetup-pre.target \
17b0f1
-	units/remote-cryptsetup.target \
17b0f1
-	units/remote-cryptsetup-pre.target
17b0f1
+	units/remote-cryptsetup.target
17b0f1
 
17b0f1
 systemd_cryptsetup_SOURCES = \
17b0f1
 	src/cryptsetup/cryptsetup.c
17b0f1
diff --git a/man/crypttab.xml b/man/crypttab.xml
17b0f1
index 7085a16234..a9197ab40e 100644
17b0f1
--- a/man/crypttab.xml
17b0f1
+++ b/man/crypttab.xml
17b0f1
@@ -196,7 +196,7 @@
17b0f1
         started after the network is available, similarly to
17b0f1
         <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
17b0f1
         units marked with <option>_netdev</option>. The service unit to set up this device
17b0f1
-        will be ordered between <filename>remote-cryptsetup-pre.target</filename> and
17b0f1
+        will be ordered between <filename>remote-fs-pre.target</filename> and
17b0f1
         <filename>remote-cryptsetup.target</filename>, instead of
17b0f1
         <filename>cryptsetup-pre.target</filename> and
17b0f1
         <filename>cryptsetup.target</filename>.</para></listitem>
17b0f1
diff --git a/man/systemd.special.xml b/man/systemd.special.xml
17b0f1
index 5529d3bf7e..e04f08bd37 100644
17b0f1
--- a/man/systemd.special.xml
17b0f1
+++ b/man/systemd.special.xml
17b0f1
@@ -81,7 +81,6 @@
17b0f1
     <filename>poweroff.target</filename>,
17b0f1
     <filename>printer.target</filename>,
17b0f1
     <filename>reboot.target</filename>,
17b0f1
-    <filename>remote-cryptsetup-pre.target</filename>,
17b0f1
     <filename>remote-cryptsetup.target</filename>,
17b0f1
     <filename>remote-fs.target</filename>,
17b0f1
     <filename>remote-fs-pre.target</filename>,
17b0f1
@@ -406,18 +405,6 @@
17b0f1
           this target unit, for compatibility with SysV.</para>
17b0f1
         </listitem>
17b0f1
       </varlistentry>
17b0f1
-      <varlistentry>
17b0f1
-        <term><filename>remote-cryptsetup-pre.target</filename></term>
17b0f1
-        <listitem>
17b0f1
-          <para>This target unit is automatically ordered before all cryptsetup devices
17b0f1
-          marked with the <option>_netdev</option>. It can be used to execute additional
17b0f1
-          units before such devices are set up.</para>
17b0f1
-
17b0f1
-          <para>It is ordered after <filename>network.target</filename> and
17b0f1
-          <filename>network-online.target</filename>, and also pulls the latter in as a
17b0f1
-          <varname>Wants=</varname> dependency.</para>
17b0f1
-        </listitem>
17b0f1
-      </varlistentry>
17b0f1
       <varlistentry>
17b0f1
         <term><filename>remote-cryptsetup.target</filename></term>
17b0f1
         <listitem>
17b0f1
@@ -768,9 +755,10 @@
17b0f1
         <term><filename>remote-fs-pre.target</filename></term>
17b0f1
         <listitem>
17b0f1
           <para>This target unit is automatically ordered before all
17b0f1
-          remote mount point units (see above). It can be used to run
17b0f1
-          certain units before the remote mounts are established. Note
17b0f1
-          that this unit is generally not part of the initial
17b0f1
+          mount point units (see above) and cryptsetup devices
17b0f1
+          marked with the <option>_netdev</option>. It can be used to run
17b0f1
+          certain units before remote encrypted devices and mounts are established.
17b0f1
+          Note that this unit is generally not part of the initial
17b0f1
           transaction, unless the unit that wants to be ordered before
17b0f1
           all remote mounts pulls it in via a
17b0f1
           <varname>Wants=</varname> type dependency. If the unit wants
17b0f1
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
17b0f1
index 49dc8f14b4..82a280d865 100644
17b0f1
--- a/src/cryptsetup/cryptsetup-generator.c
17b0f1
+++ b/src/cryptsetup/cryptsetup-generator.c
17b0f1
@@ -114,7 +114,7 @@ static int create_disk(
17b0f1
                 "IgnoreOnIsolate=true\n"
17b0f1
                 "After=systemd-readahead-collect.service systemd-readahead-replay.service\n"
17b0f1
                 "After=%s\n",
17b0f1
-                netdev ? "remote-cryptsetup-pre.target" : "cryptsetup-pre.target");
17b0f1
+                netdev ? "remote-fs-pre.target" : "cryptsetup-pre.target");
17b0f1
 
17b0f1
         if (!nofail)
17b0f1
                 fprintf(f,
17b0f1
diff --git a/units/remote-cryptsetup-pre.target b/units/remote-cryptsetup-pre.target
17b0f1
deleted file mode 100644
17b0f1
index a375e61889..0000000000
17b0f1
--- a/units/remote-cryptsetup-pre.target
17b0f1
+++ /dev/null
17b0f1
@@ -1,15 +0,0 @@
17b0f1
-#  This file is part of systemd.
17b0f1
-#
17b0f1
-#  systemd is free software; you can redistribute it and/or modify it
17b0f1
-#  under the terms of the GNU Lesser General Public License as published by
17b0f1
-#  the Free Software Foundation; either version 2.1 of the License, or
17b0f1
-#  (at your option) any later version.
17b0f1
-
17b0f1
-[Unit]
17b0f1
-Description=Remote Encrypted Volumes (Pre)
17b0f1
-Documentation=man:systemd.special(7)
17b0f1
-RefuseManualStart=yes
17b0f1
-Before=remote-cryptsetup.target
17b0f1
-
17b0f1
-After=network.target network-online.target
17b0f1
-Wants=network-online.target
17b0f1
diff --git a/units/remote-cryptsetup.target b/units/remote-cryptsetup.target
17b0f1
index c306d521f7..d485b06726 100644
17b0f1
--- a/units/remote-cryptsetup.target
17b0f1
+++ b/units/remote-cryptsetup.target
17b0f1
@@ -8,7 +8,7 @@
17b0f1
 [Unit]
17b0f1
 Description=Remote Encrypted Volumes
17b0f1
 Documentation=man:systemd.special(7)
17b0f1
-After=remote-cryptsetup-pre.target
17b0f1
+After=remote-fs-pre.target
17b0f1
 DefaultDependencies=no
17b0f1
 Conflicts=shutdown.target
17b0f1