Skip to contentSkip to conversation

ext2fs sb= mount option fix (kernel 2.4.25)

PATCH New Andrew Church 1 participant 1 message Apr 6, 2004 ext2 file system

lore
Share & tools
lore
#0 lore raw

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

The following patch fixes a bug in the processing of the sb=
(alternate superblock) mount option for ext2: for devices with 1024-byte blocks, the value from the option is never actually used. This patch is for kernel 2.4.25. 2.6.5 also has an issue with sb=, and I'll send a patch for that separately.

--Andrew Church

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

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

ext2/super.c renamed from fs/ext2/super.c +3 -1
@@ -427,7 +427,7 @@
 	unsigned short resuid = EXT2_DEF_RESUID;
 	unsigned short resgid = EXT2_DEF_RESGID;
 	unsigned long block;
-	unsigned long logic_sb_block = 1;
+	unsigned long logic_sb_block;
 	unsigned long offset = 0;
 	kdev_t dev = sb->s_dev;
 	int blocksize = BLOCK_SIZE;
@@ -465,6 +465,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))) {