[linux-lvm] Bugs in LVM and ext2: patch for LVM

Urs Thuermann urs at isnogud.escape.de
Wed Feb 28 17:53:33 UTC 2001


Urs Thuermann <urs at isnogud.escape.de> writes:

> I've read lots of EXT2 and LVM src code and I think it turns out that
> there is a bug in both.  Andreas has already given the fix for the
> ext2, a suggestion for LVM is below (sorry, no patch, I really know to
> little about all the block sizes and buffers of block devices).

Despite my limited knowledge of the src code for buffering and block
devices I have made an patch which fixes the LVM problem for me.  I'm
not 100% sure it is correct and if it is the clean solution.  Some
kernel god should therefore take a look on it.  At least I have
running it here in my kernel.


--- linux-2.4.2/drivers/md/lvm.c.orig	Wed Feb 28 18:27:40 2001
+++ linux-2.4.2/drivers/md/lvm.c	Wed Feb 28 17:00:25 2001
@@ -376,6 +376,8 @@
 static struct hd_struct lvm_hd_struct[MAX_LV];
 static int lvm_blocksizes[MAX_LV] =
 {0,};
+static int lvm_hardsizes[MAX_LV] =
+{0,};
 static int lvm_size[MAX_LV] =
 {0,};
 static struct gendisk lvm_gendisk =
@@ -3035,11 +3037,12 @@
 		lvm_gendisk.part[i].start_sect = -1;	/* avoid partition check */
 		lvm_size[i] = lvm_gendisk.part[i].nr_sects = 0;
 		lvm_blocksizes[i] = BLOCK_SIZE;
+		lvm_hardsizes[i] = BLOCK_SIZE;
 	}
 
 	blk_size[MAJOR_NR] = lvm_size;
 	blksize_size[MAJOR_NR] = lvm_blocksizes;
-	hardsect_size[MAJOR_NR] = lvm_blocksizes;
+	hardsect_size[MAJOR_NR] = lvm_hardsizes;
 
 	return;
 } /* lvm_gen_init() */



More information about the linux-lvm mailing list