Skip to content

Commit

Permalink
udev: run pvscan --cache via systemd-run in udev if the PV label is d…
Browse files Browse the repository at this point in the history
…etected 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.
  • Loading branch information
prajnoha committed Mar 5, 2014
1 parent 3c98874 commit 2c42f60
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions WHATS_NEW
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion udev/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2c42f60

Please sign in to comment.