summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2014-03-05 14:25:08 +0100
committerPeter Rajnoha <prajnoha@redhat.com>2014-03-05 14:30:58 +0100
commit2c42f608904a853328341eac3cfd3c48033a3238 (patch)
tree6e0318052a19a3a70b321c4e8345237d2d56535e
parent3c9887467f3c33d5ea10503c74ad85c4b119d3df (diff)
downloadlvm2-2c42f608904a853328341eac3cfd3c48033a3238.tar.gz
udev: run pvscan --cache via systemd-run in udev if the PV label is detected lost
If the PV label is lost (e.g. by doing a dd on the device), call "systemd-run pvscan --cache <major>:<minor>" in 69-dm-lvm-metad.rules to inform lvmetad about this state. The reason for this is that ENV{SYSTEMD_WANTS}="lvm2-pvscan@<major>:<minor>" logic will not cause the pvscan to be fired in this case since this works only on proper device addition/removal cycle - the lvm2-pvscan service's ExecStop is called only on proper REMOVE event - the service is bound to device existence. Hence we need pvscan call via systemd-run (that instantiates a quick transient service just to call the command). See also https://bugzilla.redhat.com/show_bug.cgi?id=1063813.
-rw-r--r--WHATS_NEW1
-rw-r--r--udev/Makefile.in2
2 files changed, 2 insertions, 1 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index 8b5f31ae7..7deba2fcd 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Run pvscan --cache via systemd-run in udev if the PV label is detected lost.
Fix memleak when lvmetad discovers PV to appear on another device.
Fix calculation of maximum size of COW device for snapshot (2.02.99).
Do not allow stripe size to be bigger then extent size for lvresize.
diff --git a/udev/Makefile.in b/udev/Makefile.in
index 40a467163..a2e257130 100644
--- a/udev/Makefile.in
+++ b/udev/Makefile.in
@@ -47,7 +47,7 @@ BLKID_RULE=IMPORT{program}=\"${SBIN}\/blkid -o udev -p \$$tempnode\"
endif
ifeq ("@UDEV_SYSTEMD_BACKGROUND_JOBS@", "yes")
-PVSCAN_RULE=ENV{SYSTEMD_ALIAS}=\"\/dev\/block\/\$$major:\$$minor\"\nENV{ID_MODEL}=\"LVM PV \$$env{ID_FS_UUID_ENC} on \/dev\/\$$name\"\nENV{SYSTEMD_WANTS}=\"lvm2-pvscan@\$$major:\$$minor.service\"
+PVSCAN_RULE=ACTION\!=\"remove\", ENV{LVM_PV_GONE}==\"1\", RUN\+=\"@bindir@/systemd-run $(LVM_EXEC)\/lvm pvscan --cache \$$major\:\$$minor\", GOTO=\"lvm_end\"\nENV{SYSTEMD_ALIAS}=\"\/dev\/block\/\$$major:\$$minor\"\nENV{ID_MODEL}=\"LVM PV \$$env{ID_FS_UUID_ENC} on \/dev\/\$$name\"\nENV{SYSTEMD_WANTS}=\"lvm2-pvscan@\$$major:\$$minor.service\"
else
PVSCAN_RULE=RUN\+\=\"$(LVM_EXEC)/lvm pvscan --background --cache --activate ay --major \$$major --minor \$$minor\", ENV{LVM_SCANNED}=\"1\"
endif