A problem in LVM1 kernel code lvm.c::lvm_do_vg_create()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear LVM guys,

 

I find an issue in the LVM1 kernel code for function lvm.c::lvm_do_vg_create():

In the original code, the vg_count will be increased only when this function is executed successfully. But I think the vg_count should be increased after the variable vg[VG_CHR(minor)] is updated. Given the reason that after the variable vg[VG_CHR(minor)] is updated, for any failure case, lvm_do_vg_create() will always call lvm_do_vg_remove() that will decrease the vg_count. So the vg_count should be increased first before any call for lvm_do_vg_remove().

 

This issue did exist for our product for our LV sometimes will fail to start (corrupt snapshot). Please give me the confirmation that the above is really an issue and the following diff can resolve this issue (from the latest LVM1 CVS code), thanks.

 

 

Best regards,

More

 

Index: lvm.c

===================================================================

RCS file: /cvs/lvm/LVM/kernel/lvm.c,v

retrieving revision 1.81

diff -c -r1.81 lvm.c

*** lvm.c       5 Mar 2003 11:37:16 -0000       1.81

--- lvm.c       25 Sep 2006 09:57:26 -0000

***************

*** 1802,1807 ****

--- 1802,1809 ----

 

        vg[VG_CHR(minor)] = vg_ptr;

 

+       vg_count++;

+

        /* get the physical volume structures */

        vg_ptr->pv_act = vg_ptr->pv_cur = 0;

        for (p = 0; p < vg_ptr->pv_max; p++) {

***************

*** 1870,1877 ****

 

        vfree(snap_lv_ptr);

 

-       vg_count++;

-

 

        MOD_INC_USE_COUNT;

 

--- 1872,1877 ----

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

[Index of Archives]     [Gluster Users]     [Kernel Development]     [Linux Clusters]     [Device Mapper]     [Security]     [Bugtraq]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]

  Powered by Linux