Commit 27efbbaf authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ext2fs sb= mount option fix

From: <achurch@achurch.org> (Andrew Church)

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.
parent dbb1a307
...@@ -564,8 +564,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) ...@@ -564,8 +564,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
struct ext2_sb_info * sbi; struct ext2_sb_info * sbi;
struct ext2_super_block * es; struct ext2_super_block * es;
struct inode *root; struct inode *root;
unsigned long block, sb_block = 1; unsigned long block;
unsigned long logic_sb_block = get_sb_block(&data); unsigned long sb_block = get_sb_block(&data);
unsigned long logic_sb_block;
unsigned long offset = 0; unsigned long offset = 0;
unsigned long def_mount_opts; unsigned long def_mount_opts;
int blocksize = BLOCK_SIZE; int blocksize = BLOCK_SIZE;
...@@ -598,6 +599,8 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) ...@@ -598,6 +599,8 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
if (blocksize != BLOCK_SIZE) { if (blocksize != BLOCK_SIZE) {
logic_sb_block = (sb_block*BLOCK_SIZE) / blocksize; logic_sb_block = (sb_block*BLOCK_SIZE) / blocksize;
offset = (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))) { if (!(bh = sb_bread(sb, logic_sb_block))) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment