Package: lvm2
Version: 2.02.95-7
Severity: important
Tags: patch

Hi,

I started using bcache and I've experienced two problems in two
different installations, both related to LVM:

Case 1: When using LVM for the root FS and the physical volume is a
bcache device the LVM fails to detect the PV. The reason is that bcache
works with udev rules which may need some time to be triggered. More
specifically, in this case I had an MD-raid-1 and an SSD device combined
as a bcache device which is then used as PV. During the boot process LVM
runs after mdadm but that time between them is not enough for the udev
rules (inside initramfs) to present the bcache device and thus LVM does
not detect it. Adding a timetout in the initramfs lvm script does the
trick

Case 2: That's more tricky: Using LVM on an SSD. Then using one of the
LVs as the cache device for bcache which is then used as PV for LVM.
IOW: LVM over BCACHE over LVM. Here the problem is that the init scripts
need another round of VG activation in order to detect the second layer
of LVM.

The attached patch fixes both of this cases. I'm not sure if there's a
more optimal way of achieving this.

Thanks,
Stefanos

-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.10.5-v2-v (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages lvm2 depends on:
ii  dmsetup                   2:1.02.74-7
ii  initscripts               2.88dsf-41
ii  libc6                     2.17-7
ii  libdevmapper-event1.02.1  2:1.02.74-7
ii  libdevmapper1.02.1        2:1.02.74-7
ii  libreadline5              5.2+dfsg-2
ii  libudev0                  175-7.2
ii  lsb-base                  4.1+Debian12

lvm2 recommends no packages.

lvm2 suggests no packages.

-- Configuration Files:
/etc/init.d/lvm2 changed [not included]
/etc/lvm/lvm.conf changed [not included]

-- debconf-show failed

-- debsums errors found:
debsums: changed file /usr/share/initramfs-tools/scripts/local-top/lvm2 (from 
lvm2 package)
diff --git a/debian/lvm2.init b/debian/lvm2.init
index df599c5..0232bdd 100644
--- a/debian/lvm2.init
+++ b/debian/lvm2.init
@@ -27,7 +27,7 @@ do_start()
 case "$1" in
   start)
 	log_action_begin_msg "Setting up LVM Volume Groups"
-	do_start
+	do_start && sleep 2 && do_start
 	case "$?" in
 		0|1) log_action_end_msg 0 ;;
 		2) log_action_end_msg 1 ;;
diff --git a/debian/tree/lvm2/usr/share/initramfs-tools/scripts/local-top/lvm2 b/debian/tree/lvm2/usr/share/initramfs-tools/scripts/local-top/lvm2
index 8fdd1f8..3b64f63 100755
--- a/debian/tree/lvm2/usr/share/initramfs-tools/scripts/local-top/lvm2
+++ b/debian/tree/lvm2/usr/share/initramfs-tools/scripts/local-top/lvm2
@@ -24,6 +24,9 @@ activate_vg()
 		return 1
 	fi
 
+	# Wait for udev rules to present more devices
+	sleep 2
+
 	# Take care of lilo boot arg, risky activating of all vg
 	case "$dev" in
 	fe[0-9]*)

Reply via email to