diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2013-10-18 11:07:21 +0200 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2013-10-18 11:38:49 +0200 |
commit | 546db1c4be55d47d41082a345e15a35055223154 (patch) | |
tree | e2740a05ec3240e06126ad56b3206d5a396fd13d /udev/Makefile.in | |
parent | 9f406ce252c40a29c06dba4bebe92b570207df93 (diff) | |
download | lvm2-546db1c4be55d47d41082a345e15a35055223154.tar.gz |
udev+systemd: make pvscan --cache -aay run as systemd background job from udev
The new lvm2-pvscan@.service is responsible for on-demand execution
of "pvscan --cache --activate ay" which causes lvmetad to be
updated and LVM activation done if the VG is complete.
Also, use udev-systemd mechanism to instantiate the job as the
lvm2-pvscan@$devnode.service on each newly appeared PV in the system.
This prevents the background job to be killed (that would happen
if it was directly forked from udev rule - this behaviour is seen
in recent versions of udev with the help of systemd that can track
detached processes - the detached process would still be in the same
cgroup).
To enable this official udev-systemd protocol for instantiating
background jobs, use new --enable-udev-systemd-background-jobs
configure switch (it's disabled by default). This option is highly
recommended wherever systemd is used!
Diffstat (limited to 'udev/Makefile.in')
-rw-r--r-- | udev/Makefile.in | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/udev/Makefile.in b/udev/Makefile.in index 5c15bdb64..fdf43df5e 100644 --- a/udev/Makefile.in +++ b/udev/Makefile.in @@ -46,8 +46,14 @@ else BLKID_RULE=IMPORT{program}=\"${SBIN}\/blkid -o udev -p \$$tempnode\" endif +ifeq ("@UDEV_SYSTEMD_BACKGROUND_JOBS@", "yes") +PVSCAN_RULE=ENV{SYSTEMD_WANTS}=\"lvm2-pvscan@\$$devnode.service\" +else +PVSCAN_RULE=RUN\+\=\"$(LVM_EXEC)/lvm pvscan --background --cache --activate ay --major \$$major --minor \$$minor\", ENV{LVM_SCANNED}=\"1\" +endif + %.rules: %.rules.in - $(SED) -e "s+(DM_DIR)+$(DM_DIR)+;s+(BLKID_RULE)+$(BLKID_RULE)+;s+(DM_EXEC_RULE)+$(DM_EXEC_RULE)+;s+(DM_EXEC)+$(DM_EXEC)+;s+(LVM_EXEC_RULE)+$(LVM_EXEC_RULE)+;s+(LVM_EXEC)+$(LVM_EXEC)+;" $< >$@ + $(SED) -e "s+(DM_DIR)+$(DM_DIR)+;s+(BLKID_RULE)+$(BLKID_RULE)+;s+(PVSCAN_RULE)+$(PVSCAN_RULE)+;s+(DM_EXEC_RULE)+$(DM_EXEC_RULE)+;s+(DM_EXEC)+$(DM_EXEC)+;s+(LVM_EXEC_RULE)+$(LVM_EXEC_RULE)+;s+(LVM_EXEC)+$(LVM_EXEC)+;" $< >$@ %_install: %.rules $(INSTALL_DATA) -D $< $(udevdir)/$(<F) |