summaryrefslogtreecommitdiff
path: root/udev
Commit message (Collapse)AuthorAgeFilesLines
* udev: keep systemd vars on change event in 69-dm-lvm-metad.rules for systemd ↵Martin Wilck2018-04-172-15/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | reload The current logic that avoids setting SYSTEMD_ALIAS and SYSTEMD_WANTS on "change" events is flawed in the default "systemd background job" configuration. For systemd, it's important that device properties don't change spuriously. If an "add" event starts lvm2-pvscan@.service for a device, and a "change" event follows, removing SYSTEMD_ALIAS and SYSTEMD_WANTS from the udev db, information about unit dependencies between the device and the pvscan service can be lost in systemd, in particular if the daemon configuration is reloaded. Steps to reproduce problem: - create a device with an LVM PV - remove device - add device (generates "add" and "change" uevents for the device) (at this point SYSTEMD_ALIAS and SYSTEMD_WANTS are clear in udev db) - systemctl daemon-reload (systemd reloads udev db) - vgchange -a n - remove device => the lvm2-pvscan@.service for the device is still active although the device is gone. - add device again => the PV is not detected, because systemd sees the lvm2-pvscan@.service as active and thus doesn't restart it. The original purpose of this logic was to avoid volumes being scanned over and over again. With systemd background jobs, that isn't necessary, because systemd will not restart the job as long as it's active. Signed-off-by: Martin Wilck <mwilck@suse.com>
* udev: explicit pvscan rule in 69-dm-lvm-metad.rulesMartin Wilck2018-04-172-4/+22
| | | | | | | | | | | Make the distinction between the cases with and without systemd background jobs explicit in 69-dm-lvm-metad.rules rather than substituting the rule from the Makefile. At this stage, this improves only readibility, at the cost of one GOTO statement. This patch introduces no functional change to the udev rules. Signed-off-by: Martin Wilck <mwilck@suse.com>
* udev: also create /dev/disk/by-part{label,uuid} and gpt-auto-root symlinksPeter Rajnoha2017-07-101-0/+3
| | | | | | | | | | | | | | | The blkid we call in 13-dm-disk.rules also returns identifiers for partitions based on which the /dev/disk/by-part{uuid,label} and gpt-auto-root symlinks should be created in the same manner as we already create symlinks for filesystem labels and uuids. This is because we handle blkid calls and symlink creation under /dev/disk ourselves in our 13-dm-disk.rules for device-mapper devices for us to have more control over this process. See also https://lists.freedesktop.org/archives/systemd-devel/2017-July/039220.html and original report http://tracker.ceph.com/issues/19489 for the exact case where these symlinks were missing.
* makefiles: use configure varsZdenek Kabelac2017-02-141-1/+1
| | | | Use binaries found in configure.
* udev: rules: add comments explaining subsystem-specific rulesPeter Rajnoha2016-04-261-0/+14
|
* udev: rules: remove mpath from 10-dm.rules, superseded by 11-dm-mpath.rules ↵Peter Rajnoha2016-04-251-4/+0
| | | | | | | | | | | | | | (mpath>=0.6.0) Multipath 0.6.0 contains new 11-dm-mpath.rules which supersede the rule that was in 10-dm.rules. The 11-dm-mpath.rules are also more complete, fixing several other issues. Using the new 11-dm-mpath.rules from multipath-tools >= 0.6.0 is strongly recommended for proper DM multipath functionality! See also: http://christophe.varoqui.free.fr http://git.opensvc.com/gitweb.cgi?p=multipath-tools/.git;a=blob;f=multipath/11-dm-mpath.rules
* makefiles: avoid using vpath for rules filesZdenek Kabelac2016-03-101-2/+1
| | | | | | | | | | | | | Fixing vpath usage as it has been checking for existance of generated file also in the $(scrdir) e.g.: No need to remake target '10-dm.rules.in'; using VPATH name '...' If the $(srcdir) had been also $(builddir) and contained already generated rules file, it's been used instead generating new one. (See: http://make.mad-scientist.net/papers/how-not-to-use-vpath/)
* doc: change fsf addressZdenek Kabelac2016-01-211-1/+1
| | | | | Hmm rpmlint suggest fsf is using a different address these days, so lets keep it up-to-date
* udev: fix missing escape for +Zdenek Kabelac2015-08-121-1/+1
| | | | | Commit 3ea396e9d220cec55fd4e139be7ae486cb4ddb91 missed to escape + which is used by 'sed' as separator for 's'.
* udev: use += for SYSTEMD_WANTS instead of =Thomas Bächler2015-08-121-1/+1
| | | | | Instead of using = to override SYSTEMD_WANTS, use += to add the pvscan service.
* gitignore: Update for in-place build.Alasdair G Kergon2015-07-271-0/+5
|
* makefiles: compile files on makeZdenek Kabelac2014-04-181-0/+2
| | | | Make install should install already compiled/generated files.
* udev: run pvscan --cache via systemd-run in udev if the PV label is detected ↵Peter Rajnoha2014-03-051-1/+1
| | | | | | | | | | | | | | | | | 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.
* udev: create /dev/disk/by-id/lvm-pv-uuid-<PV_UUID> symlink for a PVPeter Rajnoha2014-02-181-0/+3
| | | | | | | | | | | | | | | | | We already have /dev/disk/by-id/dm-uuid-... (which encompasses the VG UUID and LV UUID in case of LVs since the mapping's UUID is VG+LV UUID together) and /dev/disk/by-id/dm-name-... (which encompasses the VG and LV name in case of LVs). This patch addds /dev/disk/by-id/lvm-pv-uuid-<PV_UUID> that completes this scheme and makes navigation a bit easier using PV UUIDs since one can navigate using PV UUIDs only and there's no need to do extra PV UUID <--> kernel name matching (the PV UUID is stable across reboots). This may come in handy in various scripts. Since we already have the PV UUID stored in udev database (as a result of blkid call - returned in ID_FS_UUID blkid's variable), this operation is very cheap indeed, just creating the extra one symlink.
* udev: drop cryptsetup specific rules from 10-dm.rulesPeter Rajnoha2014-01-221-2/+0
| | | | | | | | These udev flags are set directly in cryptsetup for some time now so there's no need to have it in our rules then. See also: https://code.google.com/p/cryptsetup/source/detail?spec=svn4f14b43a3d3e7310465005c401f37e19f8cb85e6&r=4f14b43a3d3e7310465005c401f37e19f8cb85e6
* udev: clear temporary variable properlyPeter Rajnoha2014-01-201-1/+1
| | | | | | Clear temporary DM_DISABLE_OTHER_RULES_FLAG properly. This did not cause any bug or problem as the temporary variable is overwritten next time it's used again, but we should still clean it properly!
* udev: do not drop SYSTEMD_READY for non-activating eventsPeter Rajnoha2014-01-141-2/+2
| | | | | | | | | | | | Do not drop device's flag to report readiness for systemd processing if there's any event that follows the activatiion event itself. Otherwise, systemd would lost track of this device on any other event that follows the activating event (IOW, we need to make SYSTEMD_READY variable change level-based, not edge-based). This patch applies for MD and loop devices used as PVs. (intra-release fix for commit 4c267c7286145165dfe078f77d18d194a21a2e1c)
* udev: fix SYSTEMD_READY assignment for foreign devices in lvmetad rulesPeter Rajnoha2013-12-111-0/+5
| | | | | | | | | | | | | | Some devices, similarly to us, are not prepared after ADD event, but after an extra CHANGE event when the device is properly set up. This includes MD and loop devices. This patch fixes the SYSTEMD_READY assignment that is crucial for proper functionality of SYSTEMD_WANTS that we use to instantiate a lvm2-pvscan@.service systemd service to activate the VG/LVs (see also bug info). All that extra handling of foreign devices should eventually be moved to rules which process those devices primarily (MD and loop)! We should only check a dedicated variable whether the device is usable or not.
* udev: wrong line in previous commitPeter Rajnoha2013-10-301-1/+1
|
* udev: properly trigger LVM scan for MD partitionsPeter Rajnoha2013-10-301-0/+1
| | | | | | | | | | MD can directly create partition devices without a need to run an extra kpartx or partprobe call. We need to react to this event in a different way as for bare MD devices - we need to handle the ADD event for KERNEL=="md[0-9]*p[0-9]*" kernel name and trigger the LVM scanning to update lvmetad to trigger autoactivation and so on... Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1023250
* udev: no need to check DM_NOSCAN in lvmetad rulesPeter Rajnoha2013-10-291-1/+0
| | | | It's covered by general DM_UDEV_DISABLE_OTHER_RULES_FLAG.
* udev: proper reset of DM_UDEV_DISABLE_OTHER_RULES_FLAG and honour this flag ↵Peter Rajnoha2013-10-292-1/+2
| | | | | | | | | | | | | | | | | | in lvmetad rules Reset the DM_UDEV_OTHER_RULES_FLAG to original value right at the time of dropping the DM_NOSCAN flag. When DM_NOSCAN is set, the DM_UDEV_DISABLE_OTHER_RULES_FLAG is also set to avoid udev processing in "other/foreign" rules. If the noscan flag is dropped, the DM_UDEV_DISABLE_OTHER_RULES_FLAG should be reset to its original value. Also, lvmetad should respect the DM_UDEV_DISABLE_OTHER_RULES_FLAG because if the volume is set with this flag it: - definitely is not a top-level device (so makes no sense for lvmetad scanning) - is not supposed to be scanned further (for any stacking on top of it, including LVM stacking itself and any autoactivation of stacked LVs)
* make: correct sed line in udev's MakefilePeter Rajnoha2013-10-221-3/+1
|
* udev+systemd: refine lvm2-pvscan@.service to better track device existencePeter Rajnoha2013-10-221-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using ENV{SYSTEMD_WANTS}=lvm2-pvscan@... to instantiate a service for lvmetad scan when the new PV appears in the system, the service is started and executed. However, to track device removal, we need to bind it (the "BindsTo" systemd directive) to a certain .device systemd unit. In default systemd setup, the device is tracked by it's name and sysfs path (there's normally a sysfs path .device systemd unit for a device and then the device name .device unit as an alias for it). Neither of these two is useful for lvmetad update as we need to bind it to device's <major>:<minor> pair. The /dev/block/<major>:<minor> is the essential symlink under /dev that exists for each block device (created by default udev rules provided by udev directly). So let's use this as an alias for the device's .device unit as well by means of "ENV{SYSTEMD_ALIAS}" declaration within udev rules which systemd understands (this will create a new alias "dev-block-<major>:<minor>.device". Then we can easily bind the "dev-block-<major>:<minor>" device systemd unit with instantiated lvm2-pvscan@<major>:<minor>.service. So once the device is removed from the systemd, the lvm-pvscan@<major>:<minor>.service executes it's ExecStop action (which in turn notifies lvmetad about the device being gone). This completes the udev-systemd-lvmetad interaction then.
* udev+systemd: make pvscan --cache -aay run as systemd background job from udevPeter Rajnoha2013-10-182-2/+8
| | | | | | | | | | | | | | | | | | | 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!
* udev: add support for "NOSCAN" flagPeter Rajnoha2013-10-083-1/+19
| | | | | | | | | | | Recognize DM_SUBSYSTEM_UDEV_FLAG0 which for LVM is the "LVM_NOSCAN" flag that causes the scanning to be skipped (mainly blkid) and also directs all the foreign rules to be skipped as well. Important thing here is that the "watch" udev rules is still set as well as the /dev/disk/by-id content created (which does not require any scanning to be done). Also, the flag is dropped on any subsequent event and scanning done...
* udev: make subsystem rules responsible for importing subsystem flagsPeter Rajnoha2013-09-301-8/+0
| | | | | | | Each subsystem rule that needs to import any of DM_SUBSYSTEM_UDEV_FLAG* flags is responsible for doing so. This simply moves control of these flags from general 10-dm.rules to any subsystem rule using these flags as each subsystem knows better how to handle these flags on its own.
* udev: fix 3min udev timeout so that it is applied for all LVM volumesPeter Rajnoha2013-09-271-2/+2
| | | | The timeout should be set before any volume skipping.
* udev: remove unused line in 69-dm-lvm-metad.rulesPeter Rajnoha2013-09-201-5/+1
| | | | | The explicit check for *_raid_member is not actually needed as this gets filtered out by the ENV{ID_FS_TYPE}!="LVM2_member|LVM1_member" rule.
* udev: keep DM_ACTIVATION and DM_UDEV_PRIMARY_SOURCE_FLAG meaning as before ↵Peter Rajnoha2013-09-122-10/+11
| | | | | | | | | commit 8d1d835 The DM_ACTIVATION and DM_UDEV_PRIMARY_SOURCE_FLAG needs to be kept the way it was for backward compatibility (e.g. the old rules are still in initramfs). This way the check in whether the device should be scanned in 69-dm-lvmetad.rules is even easier.
* udev: override new udev default timeout of 30s to original 3minPeter Rajnoha2013-09-111-0/+2
| | | | | | | | | | New versions of udev changed the default event timeout to 30s from original 3min. This causes problems with LVM processes that starve because of the IO load caused by some LVM actions (e.g. mirror/raid synchronization). Reinstate the 3min udev timeout for now until we optimize this in a way that even the 30s timeout is sufficient.
* udev: fix pvscan --cache -aay to trigger on relevant eventsPeter Rajnoha2013-09-103-25/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes the way the special devices are handled (special in this context means that they're not usable after the usual ADD event like other generic devices): - DM and MD devices are pvscanned only when they are just set up. This is the first CHANGE event that makes the device usable (the DM_UDEV_PRIMARY_SOURCE_FLAG is set for DM and the md/array_state sysfs attribute is present for MD). Whether the device is activated is remembered via DM_ACTIVATED (for DM) and LVM_MD_PV_ACTIVATED (for MD) udev environment variable. This is then used to decide whether we should fire the pvscan on ADD event to support coldplugging. For any (artificial) ADD event generated during coldplug, the device must be already set up properly to fire the pvscan on it. - Similar for loop devices. For loop devices, only CHANGE events are relevant (so there's a CHANGE after the loop device is set up as well as detached). Whether the loop has just been activated is detected via loop/backing_file sysfs attribute presence. The activation state is remembered via LVM_LOOP_PV_ACTIVATED udev environment variable. - Do not pvscan multipath device components (underlying paths). - Do not pvscan RAID device components. - Also, set LVM_SCANNED="1" udev environment variable for debug purposes (it's visible in the lvmdump -u that takes the current udev database). This variable is set once the pvscan is triggered. The table below summarises when the pvscan is triggered (marked with X, X* means fire only if the special dev is properly set up): | real ADD | real CHANGE | artificial ADD | artificial CHANGE | remove ============================================================================= DM | | X | X* | | X MD | | X | X* | | loop | | X | X* | | other | X | | X | | X
* udev: DM_ID_FS_TYPE should be ID_FS_TYPE when comparing with old valuePeter Rajnoha2013-09-101-1/+1
|
* udev: also inform lvmetad about lost LVM1 PV labelPeter Rajnoha2013-09-091-1/+1
| | | | | Addendum to 4d3b5724e0b51782000a45027de00e0fed1c9833 which covered only LVM2 PV labels.
* tools: add -b/--background for pvscan --cache -aayPeter Rajnoha2013-09-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Udev daemon has recently introduced a limit on the number of udev processes (there was no limit before). This causes a problem when calling pvscan --cache -aay in lvmetad udev rules which is supposed to activate the volumes. This activation is itself synced with udev and so it waits for the activation to complete before the pvscan finishes. The event processing can't continue until this pvscan call is finished. But if we're at the limit with the udev process count, we can't instatiate any more udev processes, all such events are queued and so we can't process the lvm activation event for which the pvscan is waiting. Then we're in a deadlock since the udev process with the pvscan --cache -aay call waits for the lvm activation udev processing to complete, but that will never happen as there's this limit hit with the number of udev processes. The process with pvscan --cache -aay actually times out eventually (3min or 30sec, depends on the version of udev). This patch makes it possible to run the pvscan --cache -aay in the background so the udev processing can continue and hence we can avoid the deadlock mentioned above.
* udev: inform lvmetad about lost PV labelPeter Rajnoha2013-08-262-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In stacked environment where we have a PV layered on top of a snapshot LV and then removing the LV, lvmetad still keeps information about the PV: [0] raw/~ $ pvcreate /dev/sda Physical volume "/dev/sda" successfully created [0] raw/~ $ vgcreate vg /dev/sda Volume group "vg" successfully created [0] raw/~ $ lvcreate -L32m vg Logical volume "lvol0" created [0] raw/~ $ lvcreate -L32m -s vg/lvol0 Logical volume "lvol1" created [0] raw/~ $ pvcreate /dev/vg/lvol1 Physical volume "/dev/vg/lvol1" successfully created [0] raw/~ $ lvremove -ff vg/lvol1 Logical volume "lvol1" successfully removed [0] raw/~ $ pvs No device found for PV BdNlu2-7bHV-XcIp-mFFC-PPuR-ef6K-yffdzO. PV VG Fmt Attr PSize PFree /dev/sda vg lvm2 a-- 124.00m 92.00m [0] raw/~ $ pvscan --cache --major 253 --minor 3 Device 253:3 not found. Cleared from lvmetad cache. This is because of the reactivation that is done just before snapshot removal as part of the process (vg/lvol1 from the example above). This causes a CHANGE event to be generated, but any scan done on the LV does not see the original data anymore (in this case the stacked PV label on top) and consequently the ID_FS_TYPE="LVM2_member" (provided by blkid scan) is not stored in udev db anymore for the LV. Consequently, the pvscan --cache is not run anymore as the dev is not identified as LVM PV by the "LVM2_member" id - lvmetad loses this info and still keeps records about the PV. We can run into a very similar problem with erasing the PV label directly: [0] raw/~ $ lvcreate -L32m vg Logical volume "lvol0" created [0] raw/~ $ pvcreate /dev/vg/lvol0 Physical volume "/dev/vg/lvol0" successfully created [0] raw/~ $ dd if=/dev/zero of=/dev/vg/lvol0 bs=1M dd: error writing '/dev/vg/lvol0': No space left on device 33+0 records in 32+0 records out 33554432 bytes (34 MB) copied, 0.380921 s, 88.1 MB/s [0] raw/~ $ pvs PV VG Fmt Attr PSize PFree /dev/sda vg lvm2 a-- 124.00m 92.00m /dev/vg/lvol0 lvm2 a-- 32.00m 32.00m [0] raw/~ $ pvscan --cache --major 253 --minor 2 No PV label found on /dev/vg/lvol0. This patch adds detection of this change from ID_FS_LABEL="LVM2_member" to ID_FS_LABEL="<whatever_else>" and hence informing the lvmetad about PV being gone.
* udev: fix lvmetad rules to not ignore loop device configurationPeter Rajnoha2013-08-161-1/+1
| | | | | | | | | | | | | | If loop device is first configured on systems where /dev/loop-control is used to dynamically create the loop device itself, there's an ADD+CHANGE even generated. But next time the existing /dev/loop[0-9]* is reused, there's only a CHANGE event since the device representing it is already present in kernel (so no ADD event in this case). We can't ignore this CHANGE event for loop devices! This is a regression caused by 756bcabbfe297688ba240a880bc2b55265ad33f0. We already had a similar problem with MD devices which was fixed by 2ac217d408470dcecb69b83d9cbf7a254747fa5b (but that one was only an intra-release fix).
* udev: fire pvscan --cache properly on CHANGE event for MD devicesPeter Rajnoha2013-05-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 756bcabbfe297688ba240a880bc2b55265ad33f0 restricted the situations at which the LVM autoactivation fires - only on ADD event for devices other than DM. However, this caused a problem for MD devices... MD devices are activated in a very similar way as DM devices: the MD dev is created on first appeareance of MD array member (ADD event) and stays *inactive* until the array is complete. Just then the MD dev turns to active state and this is reported to userspace by CHANGE event. Unfortunately, we can't differentiate between the CHANGE event coming from udev trigger/WATCH rule and CHANGE event coming from the transition to active state - MD would need to add similar logic we already use to detect this in DM world. For now, we just have to enable pvscan --cache on *all* CHANGE events for MD so the autoactivation of the LVM volumes on top of MD works. A downside of this is that a spurious CHANGE event for MD dev can cause the LVM volumes on top of it to be automatically activated. However, one should not open/change the device underneath until the device above in the stack is removed! So this situation should only happen if one opens the MD dev for read-write by mistake (and hence firing the CHANGE event because of the WATCH udev rule), or if calling udev trigger manually for the MD dev. (No WHATS_NEW here as this fixes the commit mentioned above and which has not been released yet.)
* udev: add a few comments about variables used to recognize eventsPeter Rajnoha2013-05-031-0/+18
|
* udev: also autoactivate on coldplugPeter Rajnoha2013-04-192-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 756bcabbfe297688ba240a880bc2b55265ad33f0 fixed autoactivation to not trigger on each uevent for a PV that appeared in the system most notably the events that are triggered artificially (udevadm trigger or as the result of the WATCH udev rule being applied that consequently generates CHANGE uevents). This fixed a situation in which VGs/LVs were activated when they should not. BUT we still need to care about the coldplug used at boot to retrigger the ADD events - the "udevadm trigger --action=add"! For non-DM-based PVs, this is already covered as for these we run the autoactivation on ADD event only. However, for DM-based PVs, we still need to run the autoactivation even for the artificial ADD event, reusing the udev DB content from previous proper CHANGE event that came with the DM device activation. Simply, this patch fixes a situation in which we run extra "udevadm trigger --action=add" (or echo add > /sys/block/<dev>/uevent) for DM-based PVs (cryptsetup devices, multipath devices, any other DM devices...). Without this patch, while using lvmetad + autoactivation, any VG/LV that has a DM-based PV and for which we do not call the activation directly, the VG/LV is not activated. For example a VG with an LV with root FS on it which is directly activated in initrd and then missing activation of the rest of the LVs in the VG because of unhandled uevent retrigger on boot after switching to root FS (the "coldplug"). (No WHATS_NEW here as this fixes the commit mentioned above and which was not released yet.)
* activation: fix autoactivation to not trigger on each PV changePeter Rajnoha2012-12-212-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, the pvscan --cache -aay was called on each ADD and CHANGE uevent (for a device that is not a device-mapper device) and each CHANGE event (for a PV that is a device-mapper device). This causes troubles with autoactivation in some cases as CHANGE event may originate from using the OPTION+="watch" udev rule that is defined in 60-persistent-storage.rules (part of the rules provided by udev directly) and it's used for all block devices (except fd*|mtd*|nbd*|gnbd*|btibm*|dm-*|md* devices). For example, the following sequence incorrectly activates the rest of LVs in a VG if one of the LVs in the VG is being removed: [root@rhel6-a ~]# pvcreate /dev/sda Physical volume "/dev/sda" successfully created [root@rhel6-a ~]# vgcreate vg /dev/sda Volume group "vg" successfully created [root@rhel6-a ~]# lvcreate -l1 vg Logical volume "lvol0" created [root@rhel6-a ~]# lvcreate -l1 vg Logical volume "lvol1" created [root@rhel6-a ~]# vgchange -an vg 0 logical volume(s) in volume group "vg" now active [root@rhel6-a ~]# lvs LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert lvol0 vg -wi------ 4.00m lvol1 vg -wi------ 4.00m [root@rhel6-a ~]# lvremove -ff vg/lvol1 Logical volume "lvol1" successfully removed [root@rhel6-a ~]# lvs LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert lvol0 vg -wi-a---- 4.00m ...so the vg was deactivated, then lvol1 removed, and we end up with lvol1 removed (which is ok) BUT with lvol0 activated (which is wrong)!!! This is because after lvol1 removal, we need to write metadata to the underlying device /dev/sda and that causes the CHANGE event to be generated (because of the WATCH udev rule set on this device) and this causes the pvscan --cache -aay to be reevaluated. We have to limit this and call pvscan --cache -aay to autoactivate VGs/LVs only in these cases: --> if the *PV is not a dm device*, scan only after proper device addition (ADD event) and not with any other changes (CHANGE event) --> if the *PV is a dm device*, scan only after proper mapping activation (CHANGE event + the underlying PV in a state "just activated")
* pvscan: add --activate ay option (autoactivate)Peter Rajnoha2012-06-281-1/+1
| | | | | | | | | | | Define auto_activation_handler that activates VGs/LVs automatically based on the activation/auto_activation_volume_list (activating all volumes by default if the list is not defined). The autoactivation is done within the pvscan call in 69-dm-lvmetad.rules that watches for udev events (device appearance/removal). For now, this works for non-clustered and complete VGs only.
* udev: udev rules cleanupPeter Rajnoha2012-06-275-27/+30
| | | | | | | | | | | | | | | | Remove executable path detection in udev rules and use sbindir that is configured, but still provide the original functionality by means of 'configure --enable-udev-rule-exec-detection'. Normally, the exec path for the tools called in udev rules should not differ from the sbindir used, however, there are cases this is necessary. For example different environments could be assembled in a way that these path differ for some reason (distribution installer, initrd ...). This functionality is kept for compatibility only. Any environment moving the binaries around and using different paths should be fixed eventually!
* Detect the lvm binary path in lvmetad udev rules.Peter Rajnoha2012-03-121-1/+6
| | | | | | | | | | We can't use 'DM_SBIN_PATH'. This one is set only for DM devices but not for all block devices - the pvscan is run on all relevant block devices! This LVM_SBIN_PATH (as well as DM_SBIN_PATH) detection should be removed eventually but for upstream solution, we still have to do that as there are known cases where the binaries are put either in /sbin or /usr/sbin (some installation systems, initrd systems etc.).
* Switch pvscan --cache major:minor to --major --minor.Alasdair Kergon2012-03-061-1/+1
|
* Change pvscan --lvmetad to pvscan --cache.Alasdair Kergon2012-03-021-1/+1
|
* Add skeleton for lvmetad udev rules - 69-dm-lvm-metad.rules.Peter Rajnoha2012-02-242-0/+29
| | | | | | | | | | | | | | | | | | | | Why using the order 69: - Storage processing in general happens in 60-persistent-storage.rules, including the blkid call that adds some usable information we can use for filtering and speedup (these rules are part of upstream udev and the order is preserved on most distros) - There's still some other storage-related processing done after 60-persistent-storage.rules in general. These might add some detailed storage-related information we might use to filter devices effectively (e.g. MD udev rules, ...). - We need lvmetad rules to be processed before any consumers can use the output - so the metadata cache is ready soon enough (e.g. udisks rules). - There's no official (upstream udev) document about assigning the order, so this number is chosen in best belief it will suit all scenarios.
* Clean intermediate files.Peter Rajnoha2012-02-231-1/+1
|
* Call built-in blkid conditionaly (udev version >= 176), call standard blkidPeter Rajnoha2012-02-202-2/+8
| | | | with full path otherwise.
* Switch to using built-in blkid in 13-dm-disk.rules.Peter Rajnoha2012-02-161-1/+1
| | | | Available in udev since version 176.