Skip to contentSkip to conversation

vgscan -- ERROR with 2.4.0-test13-pre4

linux-lvm Jan Niehusmann 1 participant 2 messages Dec 22, 2000

lore
Share & tools
lore
#0 lore raw

I installed 2.4.0-test13-pre4 which includes LVM 0.9, and the lvm tools from http://distro.conectiva.com.br/experimental/.

Now, when I try to boot the new kernel, I get the following message from vgscan:

vgscan -- ERROR "vg_read_with_pv_and_lv(): allocated LE of LV" can't get data of
volume group "vg1" from physical volume(s)

vgscan -d says (complete output available, but a little bit to long for the list I think)

[...]
<1> vg_read_with_pv_and_lv -- BEFORE for LV
<1> vg_read_with_pv_and_lv -- vg_this->lv[0]->lv_allocated_le: 169 <1> vg_read_with_pv_and_lv -- LEAVING with ret: -365 <1> lvm_error -- CALLED with: -365
[...]

I added another debug output which tells me the counted number of pe's (the variable npe). It is 75.
This is strange because lv no. 0 is on one disk. But it's not continous, and after le no. 75, there is a jump backwards to a lower pe number:

--- Logical extents ---

   LE    PV                        PE     reads      writes
   00000 /dev/hda5                 00190  11         2
[...]
   00073 /dev/hda5                 00263  0          0
   00074 /dev/hda5                 00264  0          0
   00075 /dev/hda5                 00265  0          0
   00076 /dev/hda5                 00139  0          0
   00077 /dev/hda5                 00140  0          0

But I don't see how this could cause a problem.

A difference between the output of 0.8's vgscan -d and 0.9's vgscan -d is that the order of pv is different:

<333> vg_read -- pv[0]->pv_name: "/dev/hda5"
<333> vg_read -- pv[1]->pv_name: "/dev/sda2"
<333> vg_read -- pv[2]->pv_name: "/dev/hdc4"

vs.

<333> vg_read -- pv[0]->pv_name: "/dev/sda2"
<333> vg_read -- pv[1]->pv_name: "/dev/hda5"
<333> vg_read -- pv[2]->pv_name: "/dev/hdc4"

Jan

#1 lore raw
Quoted 5 lines · Jan Niehusmann

Now, when I try to boot the new kernel, I get the following message from vgscan:

vgscan -- ERROR "vg_read_with_pv_and_lv(): allocated LE of LV" can't get data of
volume group "vg1" from physical volume(s)

Ok, I found the problem: The sort order of the pv's is wrong, and 0.9 is missing the code that sorts them. 0.8final's pv_read_all_pv_of_vg.c contains

      for ( p = 0; pv_tmp[p] != NULL; p++) {
         if ( strcmp ( pv_tmp[p]->vg_name, vg_name) == 0) {
            pv_this[pv_tmp[p]->pv_number-1] = pv_tmp[p];
            np++;
         }
      }

and 0.9's doesn't.

The following patch fixes it (I did this fix to prove my theory, it may not be the right way to do it):

Index: pv_read_all_pv_of_vg.c
===================================================================
RCS file: /data/cvs/LVM/tools/lib/pv_read_all_pv_of_vg.c,v retrieving revision 1.3

pv_read_all_pv_of_vg.c +3 -3
diff -u -1 -b -p -r1.3 pv_read_all_pv_of_vg.c
@@ -103,2 +103,3 @@ int pv_read_all_pv_of_vg ( char *vg_name
             pv_this_sav = pv_this;
+	    if(np<pv_tmp[p]->pv_number) np=pv_tmp[p]->pv_number;
             if ( ( pv_this = realloc ( pv_this,
@@ -111,5 +112,4 @@ int pv_read_all_pv_of_vg ( char *vg_name
             }
-            pv_this[np] = pv_tmp[p];
-            pv_this[np+1] = NULL;
-            np++;
+            pv_this[pv_tmp[p]->pv_number-1] = pv_tmp[p];
+            //pv_this[np+1] = NULL; // XXX???
          }