linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Songmin Li <lisongmin9@gmail.com>
To: linux-lvm@redhat.com
Subject: [linux-lvm] there is a vgextend sagfault with missing pv which is resolved on master, can we backport it to 2.02 branch
Date: Fri, 1 Jan 2021 17:49:49 +0800	[thread overview]
Message-ID: <CACOXiSRtQDy5gBKveWdUrA+qV7bm_U20TnKqupWhuCHbMm4sOA@mail.gmail.com> (raw)


[-- 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/

             reply	other threads:[~2021-01-05  8:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-01  9:49 Songmin Li [this message]
2021-01-05 16:22 ` [linux-lvm] there is a vgextend sagfault with missing pv which is resolved on master, can we backport it to 2.02 branch David Teigland
2021-01-11  4:57   ` Songmin Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACOXiSRtQDy5gBKveWdUrA+qV7bm_U20TnKqupWhuCHbMm4sOA@mail.gmail.com \
    --to=lisongmin9@gmail.com \
    --cc=linux-lvm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).