[linux-lvm] vgextend and vgreduce errors in 0.9

Chris Mason mason at suse.com
Mon Dec 4 20:30:08 UTC 2000


Hello everyone,

I searched through the archives for this, but did not see
any similar patches.  It looks like lvm 0.9 has some
double increments and decrements when extending/reducing
volume groups, and the lvm_get_inode code was called
twice when extending volume groups.

The following diff should fix it, along with the known
problem of an oops on vgextend.  Testing has been really,
really light, don't apply this until it has been blessed
by a few other eyes.

If there is another diff to fix the same bugs, please
forward it to me ;-)

-chris

------

--- linux/drivers/block/lvm.c.1	Mon Dec  4 14:52:31 2000
+++ linux/drivers/block/lvm.c	Mon Dec  4 16:15:18 2000
@@ -2084,20 +2084,10 @@
 		for (p = 0; p < vg_ptr->pv_max; p++) {
 			if ( ( pv_ptr = vg_ptr->pv[p]) == NULL) {
 				ret = lvm_do_pv_create(arg, vg_ptr, p);
-				lvm_do_create_proc_entry_of_pv ( vg_ptr, pv_ptr);
 				if ( ret != 0) return ret;
-	
-				/* We don't need the PE list
-				   in kernel space like LVs pe_t list */
-				pv_ptr->pe = NULL;
-				vg_ptr->pv_cur++;
-				vg_ptr->pv_act++;
-				vg_ptr->pe_total +=
-				    pv_ptr->pe_total;
-#ifdef LVM_GET_INODE
-				/* insert a dummy inode for fs_may_mount */
-				pv_ptr->inode = lvm_get_inode(pv_ptr->pv_dev);
-#endif
+                                pv_ptr = vg_ptr->pv[p] ;
+                                vg_ptr->pe_total += pv_ptr->pe_total;
+				lvm_do_create_proc_entry_of_pv ( vg_ptr, pv_ptr);
 				return 0;
 			}
 		}
@@ -2123,10 +2113,6 @@
 		    strcmp(pv_ptr->pv_name,
 			       pv_name) == 0) {
 			if (pv_ptr->lv_cur > 0) return -EPERM;
-			vg_ptr->pe_total -=
-			    pv_ptr->pe_total;
-			vg_ptr->pv_cur--;
-			vg_ptr->pv_act--;
 			lvm_do_pv_remove(vg_ptr, p);
 			/* Make PV pointer array contiguous */
 			for (; p < vg_ptr->pv_max - 1; p++)




More information about the linux-lvm mailing list