From: Lars Kellogg-Stedman <lars@larsshack.org>
To: lvm-devel@sistina.com
Cc: linux-lvm@sistina.com
Subject: [linux-lvm] Re: Here we go again: vgscan doesn't see my volume groups.
Date: Mon Nov 26 23:20:01 2001 [thread overview]
Message-ID: <20011127002330.B14754@piglet.house> (raw)
Arrrgh, after much fiddling with floppies, as I trundle patched code between my
laptop and my hosed machine, this looks partly like a bug in LVM.
Specifically, in tools/lib/pv_read_all_pv_of_vg.c, in this section of code:
/* make array contiguous again */
for ( i = 0; i < np - 2; i++) {
if ( pv_this[i] == NULL) {
/* ensure we don't have a sequence of NULLs */
if ( pv_this[i+1] == NULL) {
int j = i + 1;
while ( pv_this[j] == NULL && j < np - 1) j++;
if ( j < np - 1) pv_this[i+1] = pv_this[j];
}
pv_this[i] = pv_this[i+1];
pv_this[i+1] = NULL;
}
}
np=0;
while ( pv_this[np] != NULL) np++;
Let's step through this. Before multiple path/md handling, pv_this[] looked
like this:
[0] /dev/md0
[1] /dev/sda
[2] /dev/sde3
[3] /dev/sde4
pv_this[1] is set to NULL, because sda is part of md0, so we enter the
above section of code with pv_this[] looking like this:
[0] /dev/md0
[1] NULL
[2] /dev/sde3
[3] /dev/sde4
In the first iteration of the loop (i=0) nothing changes.
In the second iteration of this loop (i=1), we encounter a NULL value, so
we shift the list down one and set the following element to NULL, leaving us
with:
[0] /dev/md0
[1] /dev/sde3
[2] NULL
[3] /dev/sde4
And that's it. Due to the loop condition (i < np - 2), the loop exits,
since np=4 and i would be 2 in the next iteration. The following code:
while ( pv_this[np] != NULL) np++;
Will end up setting np to 2, since the NULL value in pv_this[2] will cause
the loop to exit.
I think this loop will work as intended if the loop condition were
i < np -1. In our situtation, this would cause one more iteration of the loop, and the NULL value in pv_this[2] would cause another shift to occur leaving us with:
[0] /dev/md0
[1] /dev/sde3
[2] /dev/sde4
[3] NULL
Which looks just great. I'm ignoring the sub-loop (...ensure we don't have
a sequence of NULLs...) for now, but it probably needs fixing.
I'm about to go check this out. I noticed that there is@least one other
place in this file that may have a similar problem. Results in a few minutes.
-- Lars
next reply other threads:[~2001-11-26 23:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-26 23:20 Lars Kellogg-Stedman [this message]
-- strict thread matches above, loose matches on Subject: below --
2001-11-26 11:25 [linux-lvm] Re: Here we go again: vgscan doesn't see my volume groups Lars Kellogg-Stedman
2001-11-26 12:00 ` Andreas Dilger
2001-11-26 14:11 ` Lars Kellogg-Stedman
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=20011127002330.B14754@piglet.house \
--to=lars@larsshack.org \
--cc=linux-lvm@sistina.com \
--cc=lvm-devel@sistina.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.