Workaround for the crypto-on-lvm-on-crypto disk layout

Resolves: #741655
This commit is contained in:
Michal Schmidt 2011-09-29 02:26:24 +02:00
parent a762e50cab
commit 0afbbc68db
3 changed files with 49 additions and 1 deletions

12
fedora-crypto-lvm-hack Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
#
# Test if the given device is an LVM PV. If yes, activate its VG.
#
# Suggested by Milan Brož in
# https://bugzilla.redhat.com/show_bug.cgi?id=741655#c19
device="$1"
[ -b "$device" ] || exit 1
blkid -t TYPE=LVM2_member "$device" > /dev/null && \
vgchange -a y $(pvs --noheadings -o vg_name "$device")

View File

@ -0,0 +1,23 @@
Fedora workaround for bz741655
After unlocking a crypto device, give LVM a chance to assemble a VG from it.
Needed to make the crypto-on-lvm-on-crypto disk layout work.
Non-upstream patch. Will be obsoleted as soon as LVM gets the planned
'policy daemon which will activate LV according to some system policy'.
Index: systemd-36/src/cryptsetup-generator.c
===================================================================
--- systemd-36.orig/src/cryptsetup-generator.c
+++ systemd-36/src/cryptsetup-generator.c
@@ -132,8 +132,10 @@ static int create_disk(
"RemainAfterExit=yes\n"
"TimeoutSec=0\n" /* the binary handles timeouts anyway */
"ExecStart=" SYSTEMD_CRYPTSETUP_PATH " attach '%s' '%s' '%s' '%s'\n"
+ "ExecStartPost=/lib/systemd/fedora-crypto-lvm-hack '/dev/mapper/%s'\n"
"ExecStop=" SYSTEMD_CRYPTSETUP_PATH " detach '%s'\n",
name, u, strempty(password), strempty(options),
+ name,
name);
if (has_option(options, "tmp"))

View File

@ -2,7 +2,7 @@ Name: systemd
Url: http://www.freedesktop.org/wiki/Software/systemd
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Version: 36
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv2+
Group: System Environment/Base
Summary: A System and Service Manager
@ -44,8 +44,12 @@ Source1: macros.systemd
Source2: systemd-sysv-convert
# Stop-gap, just to ensure things work out-of-the-box for this driver.
Source3: udlfb.conf
# Workaround https://bugzilla.redhat.com/show_bug.cgi?id=741655
Source4: fedora-crypto-lvm-hack
# We revert this one for https://bugzilla.redhat.com/show_bug.cgi?id=741078
Patch0: 0001-unit-fix-complementing-of-requirement-deps-with-Afte.patch
# Workaround https://bugzilla.redhat.com/show_bug.cgi?id=741655
Patch100: fedora-crypto-lvm-hack.patch
# For sysvinit tools
Obsoletes: SysVinit < 2.86-24, sysvinit < 2.86-24
@ -109,6 +113,7 @@ SysV compatibility tools for systemd
%prep
%setup -q
%patch0 -p1 -R
%patch100 -p1
%build
%configure --with-rootdir= --with-distro=fedora --with-rootlibdir=/%{_lib}
@ -167,6 +172,9 @@ install -m 0755 %{SOURCE2} %{buildroot}%{_bindir}/
mkdir -p %{buildroot}%{_sysconfdir}/modprobe.d/
install -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/modprobe.d/
# install the Fedora crypto-LVM hack
install -m 0755 %{SOURCE4} %{buildroot}/lib/systemd/
%clean
rm -rf $RPM_BUILD_ROOT
@ -260,6 +268,7 @@ fi
/usr/bin/systemd-stdio-bridge
/usr/bin/systemd-analyze
/lib/systemd/systemd-*
/lib/systemd/fedora-crypto-lvm-hack
/lib/udev/rules.d/*.rules
/lib/systemd/system-generators/systemd-cryptsetup-generator
/lib/systemd/system-generators/systemd-getty-generator
@ -353,6 +362,10 @@ fi
%{_bindir}/systemd-sysv-convert
%changelog
* Thu Sep 29 2011 Michal Schmidt <mschmidt@redhat.com> - 36-4
- Workaround for the crypto-on-lvm-on-crypto disk layout
- Resolves: #741655
* Sun Sep 25 2011 Michal Schmidt <mschmidt@redhat.com> - 36-3
- Revert an upstream patch that caused ordering cycles
- Resolves: #741078