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