Received: from mx3.redhat.com (mx3.redhat.com [172.16.48.32]) by int-mx1.corp.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k8PAmmRt014956 for ; Mon, 25 Sep 2006 06:48:48 -0400 Received: from zh.plasmon.cn ([211.97.48.10]) by mx3.redhat.com (8.13.1/8.13.1) with ESMTP id k8PAmbCF012062 for ; Mon, 25 Sep 2006 06:48:38 -0400 Message-Id: <200609251048.k8PAmbCF012062@mx3.redhat.com> From: "more.zeng" Date: Mon, 25 Sep 2006 18:23:51 +0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0127_01C6E0CF.C0939F70" Subject: [linux-lvm] A problem in LVM1 kernel code lvm.c::lvm_do_vg_create() Reply-To: LVM general discussion and development List-Id: LVM general discussion and development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , List-Id: To: linux-lvm@redhat.com This is a multi-part message in MIME format. ------=_NextPart_000_0127_01C6E0CF.C0939F70 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Dear LVM guys, =20 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(). =20 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. =20 =20 Best regards, More =20 Index: lvm.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 ---- =20 vg[VG_CHR(minor)] =3D vg_ptr; =20 + vg_count++; +=20 /* get the physical volume structures */ vg_ptr->pv_act =3D vg_ptr->pv_cur =3D 0; for (p =3D 0; p < vg_ptr->pv_max; p++) { *************** *** 1870,1877 **** =20 vfree(snap_lv_ptr); =20 - vg_count++; -=20 =20 MOD_INC_USE_COUNT; =20 --- 1872,1877 ---- ------=_NextPart_000_0127_01C6E0CF.C0939F70 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable

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

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D

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)] =3D vg_ptr;

  =

+    &nbs= p;  vg_count++;

+ =

     = ;   /* get the physical volume structures */

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

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

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

*** 1870,1877 = ****

  =

     = ;   vfree(snap_lv_ptr);

  =

-    &nbs= p;  vg_count++;

- =

  =

     = ;   MOD_INC_USE_COUNT;

  =

--- 1872,1877 = ----

=
------=_NextPart_000_0127_01C6E0CF.C0939F70--