Skip to contentSkip to conversation

ext2fs sb= mount option fix (kernel 2.6.5)

PATCH New Andrew Church 1 participant 1 message Apr 6, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext2fs sb= mount option fix (kernel 2.6.5)

The following patch fixes a bug in the processing of the sb=
(alternate superblock) mount option for ext2: when changing the device block size, the given superblock is ignored and the code reverts to using block 1. This patch is against kernel 2.6.5.

--Andrew Church

    [email protected]
    http://achurch.org/

---------------------------------------------------------------------------

ext2/super.c renamed from ext2/super.c.old +4 -2
@@ -564,8 +564,8 @@
 	struct ext2_sb_info * sbi;
 	struct ext2_super_block * es;
 	struct inode *root;
-	unsigned long block, sb_block = 1;
-	unsigned long logic_sb_block = get_sb_block(&data);
+	unsigned long block, sb_block = get_sb_block(&data);
+	unsigned long logic_sb_block;
 	unsigned long offset = 0;
 	unsigned long def_mount_opts;
 	int blocksize = BLOCK_SIZE;
@@ -598,6 +598,8 @@
 	if (blocksize != BLOCK_SIZE) {
 		logic_sb_block = (sb_block*BLOCK_SIZE) / blocksize;
 		offset = (sb_block*BLOCK_SIZE) % blocksize;
+	} else {
+		logic_sb_block = sb_block;
 	}
 
 	if (!(bh = sb_bread(sb, logic_sb_block))) {