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 k8R3cRM0008138 for ; Tue, 26 Sep 2006 23:38:27 -0400 Received: from zh.plasmon.cn ([211.97.48.10]) by mx3.redhat.com (8.13.1/8.13.1) with ESMTP id k8R3c6ru016541 for ; Tue, 26 Sep 2006 23:38:08 -0400 Message-Id: <200609270338.k8R3c6ru016541@mx3.redhat.com> From: "more.zeng" Subject: RE: [linux-lvm] A problem in LVM1 kernel code lvm.c::lvm_do_vg_create() Date: Wed, 27 Sep 2006 11:33:11 +0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0163_01C6E228.B6CF3580" In-Reply-To: <200609251048.k8PAmbCF012062@mx3.redhat.com> 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 general discussion and development' This is a multi-part message in MIME format. ------=_NextPart_000_0163_01C6E228.B6CF3580 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Can anyone have a view of the following issue in the LVM1 kernel code? = Very thanks for any comment. =20 =20 Best regards, More =20 _____ =20 From: linux-lvm-bounces@redhat.com [mailto:linux-lvm-bounces@redhat.com] = On Behalf Of more.zeng Sent: 2006=E5=B9=B49=E6=9C=8825=E6=97=A5 18:24 To: linux-lvm@redhat.com Subject: [linux-lvm] A problem in LVM1 kernel code = lvm.c::lvm_do_vg_create() =20 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_0163_01C6E228.B6CF3580 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable

Can anyone have a = view of the following issue in the LVM1 kernel code? Very thanks for any = comment.

 <= /span>

 <= /span>

Best = regards,

More

 <= /span>


From: = linux-lvm-bounces@redhat.com [mailto:linux-lvm-bounces@redhat.com] On Behalf Of more.zeng
Sent: = 2006
=E5=B9=B49=E6=9C=8825=E6=97=A5 18:24
To: = linux-lvm@redhat.com
Subject: [linux-lvm] A = problem in LVM1 kernel code lvm.c::lvm_do_vg_create()

 

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_0163_01C6E228.B6CF3580--