linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] there is a vgextend sagfault with missing pv which is resolved on master, can we backport it to 2.02 branch
@ 2021-01-01  9:49 Songmin Li
  2021-01-05 16:22 ` David Teigland
  0 siblings, 1 reply; 3+ messages in thread
From: Songmin Li @ 2021-01-01  9:49 UTC (permalink / raw)
  To: linux-lvm


[-- Attachment #1.1: Type: text/plain, Size: 2281 bytes --]

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@redhat.com>
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.

[-- Attachment #1.2: Type: text/html, Size: 2634 bytes --]

[-- Attachment #2: Type: text/plain, Size: 197 bytes --]

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-11  9:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-01  9:49 [linux-lvm] there is a vgextend sagfault with missing pv which is resolved on master, can we backport it to 2.02 branch Songmin Li
2021-01-05 16:22 ` David Teigland
2021-01-11  4:57   ` Songmin Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).