Hi,
I have a lv format with raid1, and one of the pv is fault recently.
I prepare to repair via follow steps:
1. Unplug the fault device and plug new deive
2. Format new device as pv
3. Add new pv to the vg via vgextend (which segfault here)
# vgextend a /dev/sdc2
WARNING: Device for PV ZYO8Gj-cxTa-sEUj-vWjM-H5MA-BWgu-Yeuk27 not found or rejected by a filter.
Couldn't find device with uuid ZYO8Gj-cxTa-sEUj-vWjM-H5MA-BWgu-Yeuk27.
WARNING: Device for PV ZYO8Gj-cxTa-sEUj-vWjM-H5MA-BWgu-Yeuk27 not found or rejected by a filter.
zsh: segmentation fault (core dumped) vgextend a /dev/sdc2
4. Repair via lvconvert
Since the segfault, I can not repair the lvm, so I debug into it, I seems dev parameter is a null pointer, which cause the segfault.
#0 0x000055bec50e4b15 in dev_get_direct_block_sizes (dev=0x0, physical_block_size=physical_block_size@entry=0x7fff7e169a50, logical_block_size=logical_block_size@entry=0x7fff7e169a54) at device/dev-io.c:141
#1 0x000055bec512cb48 in vg_extend_each_pv (vg=vg@entry=0x55bec75d2820, pp=pp@entry=0x7fff7e169cb0) at metadata/metadata.c:719
I check the file on git, the issue is fixed on the master branch, but not backport to 2.02 stable now (my lvm2 version is 2.02.187).
The commit in master is:
# git show 98d420200
Alias tip: gsh 98d420200
commit 98d420200e16b450b6b7e33b83bdf36a59196d6d
Author: David Teigland <teigland@xxxxxxxxxx>
Date: Tue Sep 3 10:07:56 2019 -0500
vgextend: check missing device during block size check
Checking the block size when a device is missing could
trigger a segfault.
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 6d21ff99c..61906cc4b 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -769,6 +769,9 @@ int vg_extend_each_pv(struct volume_group *vg, struct pvcreate_params *pp)
logical_block_size = 0;
physical_block_size = 0;
+ if (!pvl->pv->dev)
+ continue;
+
if (!dev_get_direct_block_sizes(pvl->pv->dev, &physical_block_size, &logical_block_size))
continue;
After apply this patch, I can repair the lvm as normal.
Can we backport this commit to 2.02 branch so we can repair lvm on disk fault?
Thanks.
_______________________________________________ linux-lvm mailing list linux-lvm@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/linux-lvm read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/