linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Zhao Heming <heming.zhao@suse.com>
To: linux-lvm@redhat.com
Cc: zkabelac@redhat.com, teigland@redhat.com,
	Zhao Heming <heming.zhao@suse.com>
Subject: [linux-lvm] [PATCH 1/2] metadata: check pv->dev null when setting PARTIAL_LV
Date: Thu, 10 Sep 2020 23:37:27 +0800	[thread overview]
Message-ID: <1599752247-30793-1-git-send-email-heming.zhao@suse.com> (raw)

The code in vg_read():
```
if (missing_pv_dev || missing_pv_flag)
    vg_mark_partial_lvs(vg, 1);
```
the missing_pv_dev not zero when pv->dev is null.
the missing_pv_flag not zero when pv->dev is not null but status MISSING_PV is true.
any above condition will trigger code to set PARTIAL_LV.
So in _lv_mark_if_partial_single(), there should add  '|| (!pv->dev)' case.

Below comment by David:
And the MISSING_PV flag was not used consistently, so there were cases
where pv->dev was null but the flag was not set. So to check for null dev
until it's more confidence in how that flag is used.

Signed-off-by: Zhao Heming <heming.zhao@suse.com>
---
 lib/metadata/metadata.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 8b8c491..5f444a6 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -2048,11 +2048,13 @@ static int _lv_mark_if_partial_single(struct logical_volume *lv, void *data)
 	unsigned s;
 	struct _lv_mark_if_partial_baton baton = { .partial = 0 };
 	struct lv_segment *lvseg;
+	struct physical_volume *pv;
 
 	dm_list_iterate_items(lvseg, &lv->segments) {
 		for (s = 0; s < lvseg->area_count; ++s) {
 			if (seg_type(lvseg, s) == AREA_PV) {
-				if (is_missing_pv(seg_pv(lvseg, s)))
+				pv = seg_pv(lvseg, s);
+				if (is_missing_pv(pv) || !pv->dev)
 					lv->status |= PARTIAL_LV;
 			}
 		}
-- 
1.8.3.1

             reply	other threads:[~2020-09-10 15:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10 15:37 Zhao Heming [this message]
2020-09-11 12:17 ` Zdenek Kabelac
2020-09-11 13:59   ` heming.zhao
2020-09-11 14:32     ` Zdenek Kabelac

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=1599752247-30793-1-git-send-email-heming.zhao@suse.com \
    --to=heming.zhao@suse.com \
    --cc=linux-lvm@redhat.com \
    --cc=teigland@redhat.com \
    --cc=zkabelac@redhat.com \
    --subject='Re: [linux-lvm] [PATCH 1/2] metadata: check pv->dev null when setting PARTIAL_LV' \
    /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

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).