[linux-lvm] Fixes for vgcreate bugs.

Simon Green s_green at bigpond.com
Thu Feb 10 10:12:00 UTC 2000


Hi,

I just joined this list, so forgive me if I say something which has
already been said. The latest 0.8i vgcreate has a bug in it where the
first volume group created will cause a seg. fault if the /etc/lvmtab
file is 1 byte long, as it is after a vgscan has been run. I note
several comments in the changelog about this being fixed, but it still
happened to me every time I tried it. Once at least one volume group has
been created, vgcreate is fine.

The work-around is to create a 0-byte /etc/lvmtab. Vgcreate will then
give an error, but a vgscan will recover the volume group. The fix (as
far as I can see) is as follows.

In the files:

****************** lvm_tab_vg_insert.c

lvm_tab_vg_insert_end:

   if ( vg_name_ptr     != NULL) free ( vg_name_ptr);
   if ( vg_name_ptr_sav != NULL) free ( vg_name_ptr_sav);
   if ( data            != NULL) free ( data);

                        BECOMES

lvm_tab_vg_insert_end:

   if ( vg_name_ptr     != NULL) free ( vg_name_ptr);
   if ( vg_name_ptr_sav != NULL) free ( vg_name_ptr_sav);
   if ( data            != NULL) {
    free ( data);
    data = NULL;
   }



*******************lvm_tab_vg_check_exist.c
   if ( i >= size || size < 2) ret = FALSE;

   free ( data);

                        BECOMES

   if ( i >= size || size < 2) ret = FALSE;

   free ( data);
   data = NULL;



Basically, in lvm_tab_vg_check_exist_all_vg.c, there is a if (data !=
NULL) {free(data); data = NULL;} statement. When "data" is freed in one
of the other two functions above, it is not reset to NULL, leading to an
attempt to free it a second time, which causes the seg. fault. I can
send in the diffs tomorrow if anyone's interested.

Please cc any replies to greencs at logica.com.

Cheers
Simon





More information about the linux-lvm mailing list