[linux-lvm] A problem in LVM1 kernel code lvm.c::lvm_do_vg_create()

more.zeng mzeng at plasmon.cn
Mon Sep 25 10:23:51 UTC 2006

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,



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 ****




-       vg_count++;





--- 1872,1877 ----

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20060925/248d9919/attachment.htm>

More information about the linux-lvm mailing list