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 k8PBAWfR024915 for ; Mon, 25 Sep 2006 07:10:32 -0400 Received: from zh.plasmon.cn ([211.97.48.10]) by mx3.redhat.com (8.13.1/8.13.1) with ESMTP id k8PBAINQ017628 for ; Mon, 25 Sep 2006 07:10:19 -0400 Message-Id: <200609251110.k8PBAINQ017628@mx3.redhat.com> From: "more.zeng" Date: Mon, 25 Sep 2006 18:12:12 +0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0123_01C6E0CE.1FAB90A0" 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: lvm-cvs@sources.redhat.com Cc: linux-lvm@redhat.com This is a multi-part message in MIME format. ------=_NextPart_000_0123_01C6E0CE.1FAB90A0 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_0123_01C6E0CE.1FAB90A0 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=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 5 = Mar 2003 11:37:16 -0000=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = 1.81

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

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

*** 1802,1807 ****

--- 1802,1809 ----

=C2=A0

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = vg[VG_CHR(minor)] =3D vg_ptr;

=C2=A0

+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = vg_count++;

+

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* = get the physical volume structures */

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

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

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

*** 1870,1877 ****

=C2=A0

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = vfree(snap_lv_ptr);

=C2=A0

-=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = vg_count++;

-

=C2=A0

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = MOD_INC_USE_COUNT;

=C2=A0

--- 1872,1877 ----

------=_NextPart_000_0123_01C6E0CE.1FAB90A0--