master - conf: use use_blkid_wiping=0 if not defined in lvm.conf and support not compiled in
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8423be80eea3af...
Commit: 8423be80eea3af40355edbdb1e14eed5cd3000a2
Parent: c0e0f5a9234a5ad4083e370c127d394c94726a1c
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Feb 10 14:53:10 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Feb 10 14:53:10 2016 +0100
conf: use use_blkid_wiping=0 if not defined in lvm.conf and support not compiled in
Normally, we generate and provide lvm.conf file where use_blkid_wiping
is set based on whether support for this is compiled in or not. This was
generated properly based on configure.
However, if lvm.conf is not used at all (someone deletes it) or the value
in lvm.conf is commented out (user edited it), we still need to use
proper default value that is based on DEFAULT_USE_BLKID_WIPING taken
from configure script - we used hardcoded value of "1" in this case
by mistake.
---
WHATS_NEW | 1 +
lib/config/config_settings.h | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 48fcd55..6ae8126 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.142 -
====================================
+ Use use_blkid_wiping=0 if not defined in lvm.conf and support not compiled in.
Do not check for suspended devices if scanning for lvmetad update.
Fix part. table filter with external_device_info_source="udev" and blkid<2.20.
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 210a06f..e554b8e 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -420,7 +420,7 @@ cfg(allocation_maximise_cling_CFG, "maximise_cling", allocation_CFG_SECTION, 0,
"the same disks. This setting can be used to disable the changes\n"
"and revert to the previous algorithm.\n")
-cfg(allocation_use_blkid_wiping_CFG, "use_blkid_wiping", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 105), "@DEFAULT_USE_BLKID_WIPING@", 0, NULL,
+cfg(allocation_use_blkid_wiping_CFG, "use_blkid_wiping", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_USE_BLKID_WIPING, vsn(2, 2, 105), "@DEFAULT_USE_BLKID_WIPING@", 0, NULL,
"Use blkid to detect existing signatures on new PVs and LVs.\n"
"The blkid library can detect more signatures than the native LVM\n"
"detection code, but may take longer. LVM needs to be compiled with\n"
8 years, 2 months
master - filter: do not check for suspended devs in filter-usable in lvmetad mode
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c0e0f5a9234a5a...
Commit: c0e0f5a9234a5ad4083e370c127d394c94726a1c
Parent: 1498bc8cc442ebafea95e5dd8af69cdcd43619c2
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Feb 3 14:40:52 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Feb 3 14:57:36 2016 +0100
filter: do not check for suspended devs in filter-usable in lvmetad mode
We already do check for suspended devs within udev rules where
the pvscan is to update lvmetad. So the check for suspended devs
in "pre-lvmetad" chain is not useful here - remove it - it may
be a source of hardly to detect races anyway (if udev rule detects
the device is not suspended and then the pvscan instance sees the
dev as suspended, we may end up not reacting to the event properly).
---
WHATS_NEW | 1 +
lib/filters/filter-usable.c | 9 +--------
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index c2f22e9..48fcd55 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.142 -
====================================
+ Do not check for suspended devices if scanning for lvmetad update.
Fix part. table filter with external_device_info_source="udev" and blkid<2.20.
Version 2.02.141 - 25th January 2016
diff --git a/lib/filters/filter-usable.c b/lib/filters/filter-usable.c
index 129723d..4ee2e9d 100644
--- a/lib/filters/filter-usable.c
+++ b/lib/filters/filter-usable.c
@@ -126,15 +126,8 @@ static int _passes_usable_filter(struct dev_filter *f, struct device *dev)
break;
case FILTER_MODE_PRE_LVMETAD:
ucp.check_empty = 1;
- /*
- * If we're scanning for lvmetad update,
- * we don't want to hang on blocked/suspended devices.
- * When the device is unblocked/resumed, surely,
- * there's going to be a CHANGE event so the device
- * gets scanned via udev rule anyway after resume.
- */
ucp.check_blocked = 1;
- ucp.check_suspended = 1;
+ ucp.check_suspended = 0;
ucp.check_error_target = 1;
ucp.check_reserved = 1;
break;
8 years, 2 months
master - metadata: format: also delete bootloader areas from lvmcache when reading lvm1 and pool label
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1498bc8cc442eb...
Commit: 1498bc8cc442ebafea95e5dd8af69cdcd43619c2
Parent: ec43f55445966b5075fa8083921d182a0a138326
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Feb 2 13:54:19 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Feb 2 13:57:19 2016 +0100
metadata: format: also delete bootloader areas from lvmcache when reading lvm1 and pool label
lvm1 and pool format do not support bootloader areas and we need to
remove any existing associated bootloader areas when we read lvm1 and
pool labels.
This has its importance if we're converting from one format to another
and we're reusing lvmcache in long-running commands (e.g. clvmd or lvm
shell) and we need to make lvmcache consistent and valid for current format.
---
lib/format1/lvm1-label.c | 1 +
lib/format_pool/disk_rep.c | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/lib/format1/lvm1-label.c b/lib/format1/lvm1-label.c
index 6f8ee54..b600bd7 100644
--- a/lib/format1/lvm1-label.c
+++ b/lib/format1/lvm1-label.c
@@ -81,6 +81,7 @@ static int _lvm1_read(struct labeller *l, struct device *dev, void *buf,
lvmcache_set_device_size(info, ((uint64_t)xlate32(pvd->pv_size)) << SECTOR_SHIFT);
lvmcache_del_mdas(info);
+ lvmcache_del_bas(info);
lvmcache_make_valid(info);
return 1;
diff --git a/lib/format_pool/disk_rep.c b/lib/format_pool/disk_rep.c
index 75d5299..688c521 100644
--- a/lib/format_pool/disk_rep.c
+++ b/lib/format_pool/disk_rep.c
@@ -105,6 +105,7 @@ int read_pool_label(struct pool_list *pl, struct labeller *l,
lvmcache_set_device_size(info, ((uint64_t)xlate32_be(pd->pl_blocks)) << SECTOR_SHIFT);
lvmcache_del_mdas(info);
+ lvmcache_del_bas(info);
lvmcache_make_valid(info);
pl->dev = dev;
8 years, 2 months
master - filters: partitioned: fix partition table filter with external_device_info_source="udev" and blkid<2.20
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ec43f55445966b...
Commit: ec43f55445966b5075fa8083921d182a0a138326
Parent: 762b0d697ff7456d0a450121e41eff00cd5a7f08
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Feb 2 13:28:11 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Feb 2 13:28:11 2016 +0100
filters: partitioned: fix partition table filter with external_device_info_source="udev" and blkid<2.20
Non-dm devices have ID_PART_TABLE_TYPE variable exported in
udev db from blkid scan for *both* whole devices and partitions.
We used ID_PART_ENTRY_DISK in addition to decide whether this
is the whole device or partition and then we filtered out only
whole devices where the partition table really is.
However, ID_PART_ENTRY_DISK was added in blkid 2.20 so we need
to use a different set of variables to decide on whole devices
and partitions on systems where older blkid is still used.
Now, we use ID_PART_TABLE_TYPE to detect that there's something
related to partitioning with this device and we use DEVTYPE variable
instead to decide between whole device (DEVTYPE="disk") and partition
(DEVTYPE="partition").
For dm devices it's simpler, we have ID_PART_TABLE_TYPE variable\
set in udev db for whole devices. It's not set for partitions,
hence we don't need more variable in addition to make the decision
on whole device vs. partition (dm devices do not have regular
partitions, hence DEVTYPE can't be used anyway, it's always set
to "disk" for whole disks and partitions).
---
WHATS_NEW | 1 +
lib/device/dev-ext-udev-constants.h | 4 +++-
lib/device/dev-type.c | 34 +++++++++++++++++++++++++++-------
3 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 96c7cd6..c2f22e9 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.142 -
====================================
+ Fix part. table filter with external_device_info_source="udev" and blkid<2.20.
Version 2.02.141 - 25th January 2016
====================================
diff --git a/lib/device/dev-ext-udev-constants.h b/lib/device/dev-ext-udev-constants.h
index 2e2fb08..5b9a096 100644
--- a/lib/device/dev-ext-udev-constants.h
+++ b/lib/device/dev-ext-udev-constants.h
@@ -32,7 +32,9 @@
#define DEV_EXT_UDEV_BLKID_TYPE_RAID_SUFFIX "_raid_member"
#define DEV_EXT_UDEV_BLKID_TYPE_SW_RAID "linux_raid_member"
#define DEV_EXT_UDEV_BLKID_PART_TABLE_TYPE "ID_PART_TABLE_TYPE"
-#define DEV_EXT_UDEV_BLKID_PART_ENTRY_DISK "ID_PART_ENTRY_DISK"
+
+#define DEV_EXT_UDEV_DEVTYPE "DEVTYPE"
+#define DEV_EXT_UDEV_DEVTYPE_DISK "disk"
/*
* DEV_EXT_UDEV_MPATH_DEVICE_PATH is set by multipath in udev db
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
index b033462..a6223dc 100644
--- a/lib/device/dev-type.c
+++ b/lib/device/dev-type.c
@@ -333,23 +333,43 @@ static int _has_partition_table(struct device *dev)
}
#ifdef UDEV_SYNC_SUPPORT
-static int _udev_dev_is_partitioned(struct device *dev)
+static int _udev_dev_is_partitioned(struct dev_types *dt, struct device *dev)
{
struct dev_ext *ext;
+ struct udev_device *device;
+ const char *value;
if (!(ext = dev_ext_get(dev)))
return_0;
- if (!udev_device_get_property_value((struct udev_device *)ext->handle, DEV_EXT_UDEV_BLKID_PART_TABLE_TYPE))
+ device = (struct udev_device *) ext->handle;
+ if (!(value = udev_device_get_property_value(device, DEV_EXT_UDEV_BLKID_PART_TABLE_TYPE)))
return 0;
- if (udev_device_get_property_value((struct udev_device *)ext->handle, DEV_EXT_UDEV_BLKID_PART_ENTRY_DISK))
- return 0;
+ /*
+ * Device-mapper devices have DEV_EXT_UDEV_BLKID_PART_TABLE_TYPE
+ * variable set if there's partition table found on whole device.
+ * Partitions do not have this variable set - it's enough to use
+ * only this variable to decide whether this device has partition
+ * table on it.
+ */
+ if (MAJOR(dev->dev) == dt->device_mapper_major)
+ return 1;
- return 1;
+ /*
+ * Other devices have DEV_EXT_UDEV_BLKID_PART_TABLE_TYPE set for
+ * *both* whole device and partitions. We need to look at the
+ * DEV_EXT_UDEV_DEVTYPE in addition to decide - whole device
+ * with partition table on it has this variable set to
+ * DEV_EXT_UDEV_DEVTYPE_DISK.
+ */
+ if (!(value = udev_device_get_property_value(device, DEV_EXT_UDEV_DEVTYPE)))
+ return_0;
+
+ return !strcmp(value, DEV_EXT_UDEV_DEVTYPE_DISK);
}
#else
-static int _udev_dev_is_partitioned(struct device *dev)
+static int _udev_dev_is_partitioned(struct dev_types *dt, struct device *dev)
{
return 0;
}
@@ -386,7 +406,7 @@ int dev_is_partitioned(struct dev_types *dt, struct device *dev)
return _native_dev_is_partitioned(dt, dev);
if (dev->ext.src == DEV_EXT_UDEV)
- return _udev_dev_is_partitioned(dev);
+ return _udev_dev_is_partitioned(dt, dev);
log_error(INTERNAL_ERROR "Missing hook for partition table recognition "
"using external device info source %s", dev_ext_name(dev));
8 years, 2 months