All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Teigland <teigland@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - online files: fix vgname check
Date: Fri, 12 Nov 2021 18:27:05 +0000 (GMT)	[thread overview]
Message-ID: <20211112182705.9B443385840F@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=66f0fe57c3b376672696e3e7f4fe9e691a06d482
Commit:        66f0fe57c3b376672696e3e7f4fe9e691a06d482
Parent:        5dbf316cee12484ad701367ff519bebe1523ef9a
Author:        David Teigland <teigland@redhat.com>
AuthorDate:    Fri Nov 12 11:52:36 2021 -0600
Committer:     David Teigland <teigland@redhat.com>
CommitterDate: Fri Nov 12 11:52:36 2021 -0600

online files: fix vgname check

The pvs_online file for a PV will not contain a vgname
if the PV has no metadata, so don't require matching
vgname with the pvs_lookup file.
---
 lib/device/online.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lib/device/online.c b/lib/device/online.c
index c67f45001..024485bb3 100644
--- a/lib/device/online.c
+++ b/lib/device/online.c
@@ -415,8 +415,17 @@ int get_pvs_lookup(struct dm_list *pvs_online, const char *vgname)
 		if (!online_pvid_file_read(path, &file_major, &file_minor, file_vgname, file_devname))
 			goto_bad;
 
-		if (vgname && strcmp(file_vgname, vgname))
+		/*
+		 * PVs without metadata will not have a vgname in their pvid
+		 * file, but the purpose of using the lookup file is that we
+		 * know the PV is for this VG even without the pvid vgname
+		 * field.
+		 */
+		if (vgname && file_vgname[0] && strcmp(file_vgname, vgname)) {
+			/* Should never happen */
+			log_error("Incorrect VG lookup file %s PVID %s %s.", vgname, pvid, file_vgname);
 			goto_bad;
+		}
 
 		if (!(po = zalloc(sizeof(*po))))
 			goto_bad;



                 reply	other threads:[~2021-11-12 18:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20211112182705.9B443385840F@sourceware.org \
    --to=teigland@sourceware.org \
    --cc=lvm-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.