delay lvm scan, until udev has settled
authorHarald Hoyer <harald@redhat.com>
Mon, 13 Jul 2009 13:54:02 +0000 (15:54 +0200)
committerHarald Hoyer <harald@redhat.com>
Mon, 13 Jul 2009 14:24:41 +0000 (16:24 +0200)
modules.d/90lvm/64-lvm-vol_id.rules
modules.d/90lvm/64-lvm.rules
modules.d/90lvm/install
modules.d/90lvm/lvm_scan.sh [new file with mode: 0755]

index 4cebb46..2b0f44d 100644 (file)
@@ -9,7 +9,7 @@ ACTION!="add|change", GOTO="lvm_end"
 
 KERNEL=="dm-*", IMPORT{program}="vol_id --export $tempnode"
 
-ENV{ID_FS_TYPE}=="LVM2_member", RUN+="/bin/sh -c '/sbin/lvm vgscan; /sbin/lvm vgchange -ay'"
+ENV{ID_FS_TYPE}=="LVM2_member", RUN+="/bin/ln -fs /sbin/lvm_scan /initqueue/lvm_scan.sh"
 
 OPTIONS="link_priority=-100"
 ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
index c55887d..1b1b6f4 100644 (file)
@@ -9,7 +9,7 @@ ACTION!="add|change", GOTO="lvm_end"
 
 KERNEL=="dm-*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
 
-ENV{ID_FS_TYPE}=="LVM2_member", RUN+="/bin/sh -c '/sbin/lvm vgscan; /sbin/lvm vgchange -ay'"
+ENV{ID_FS_TYPE}=="LVM2_member", RUN+="/bin/ln -fs /sbin/lvm_scan /initqueue/lvm_scan.sh"
 
 OPTIONS="link_priority=-100"
 ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
index 48f6ec7..cba321b 100755 (executable)
@@ -5,3 +5,5 @@ if [ -x /lib/udev/vol_id ]; then
 else
     inst_rules "$moddir/64-lvm.rules" 64-device-mapper.rules
 fi
+
+inst "$moddir/lvm_scan.sh" /sbin/lvm_scan
diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh
new file mode 100755 (executable)
index 0000000..cd843aa
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if $UDEV_QUEUE_EMPTY >/dev/null 2>&1; then
+    [ -h "$job" ] && rm -f "$job"
+    # run lvm scan if udev has settled
+    lvm vgscan
+    lvm vgchange -ay
+fi
+