mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
dev-type: filter out partitioned device-mapper devices as unsuitable for use as PVs
Normally, if there are partitions defined on top of device-mapper device, there should be a device-mapper device created for each partiton on top of the old one and once the underlying DM device is used by another devices (partition mappings in this case), it can't be used as a PV anymore. However, sometimes, it may happen the partition mappings are missing - either the partitioning tool is not creating them if it does not contain full support for device-mapper devices or the mappings were removed. Better safe than sorry - check for partition header on DM devs and filter them out as unsuitable for PVs in case the check is positive. Whatever the user is doing, let's do our best to prevent unwanted corruption (...by running pvcreate on top of such device that would corrupt the partition header).
This commit is contained in:
parent
8dbe767340
commit
99d895014d
@ -1,5 +1,6 @@
|
||||
Version 2.02.115 -
|
||||
=====================================
|
||||
Filter out partitioned device-mapper devices as unsuitable for use as PVs.
|
||||
Also notify lvmetad about filtered device if using pvscan --cache DevicePath.
|
||||
Use LVM's own selection instead of awk expressions in clvmd startup scripts.
|
||||
Do not filter out snapshot origin LVs as unusable devices for an LVM stack.
|
||||
|
@ -272,6 +272,9 @@ static int _is_partitionable(struct dev_types *dt, struct device *dev)
|
||||
{
|
||||
int parts = major_max_partitions(dt, MAJOR(dev->dev));
|
||||
|
||||
if (MAJOR(dev->dev) == dt->device_mapper_major)
|
||||
return 1;
|
||||
|
||||
/* All MD devices are partitionable via blkext (as of 2.6.28) */
|
||||
if (MAJOR(dev->dev) == dt->md_major)
|
||||
return 1;
|
||||
|
@ -28,4 +28,5 @@ pvs "$dev1"
|
||||
# create small partition table
|
||||
echo "1 2" | sfdisk "$dev1"
|
||||
|
||||
pvs "$dev1"
|
||||
aux notify_lvmetad "$dev1"
|
||||
not pvs "$dev1"
|
||||
|
Loading…
Reference in New Issue
Block a user