[linux-lvm] vgcfgrestore bug followup

Holger Grothe grothe at mathematik.tu-darmstadt.de
Mon Jan 8 00:26:32 UTC 2001


On Thu, Jan 04, 2001 at 03:49:26PM -0200, Rik van Riel wrote:
> The patch posted on december 23rd by Jan Niehusmann
> has the extra result that vgscan always segfaults,
> and not just when in debugging output...

and

On Sun, Jan 07, 2001 at 10:33:00PM +0100, Jan Niehusmann wrote:
[...]
> This one looks like a problem I had myself. For me, the following patch
> did help: (I already posted this patch, with a description, on Dec 23)
> 
> 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
> diff -u -1 -b -p -r1.3 pv_read_all_pv_of_vg.c
> --- pv_read_all_pv_of_vg.c	2000/11/20 02:47:20	1.3
> +++ pv_read_all_pv_of_vg.c	2000/12/22 23:27:00
> @@ -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???
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IMHO the pv_this list has to be terminated by NULL (see next lines of 
source). Otherwise you may get "seg faults" while running vgscan
(see. Rik's mail). Replacing the marked line with 'pv_this[np] = NULL;' 
worked for me.

Holger
-- 
Holger Grothe  (Email: grothe at mathematik.tu-darmstadt.de)
Fachbereich Mathematik, TU Darmstadt



More information about the linux-lvm mailing list