Skip to contentSkip to conversation

2.4.1 can't mount ext2 CD-ROM

PROBLEM [email protected] 3 participants 5 messages Feb 18, 2001 – Feb 19, 2001

lore
Share & tools
lore
#0 lore raw

From: Jon Forsberg <[email protected]>

I have two ext2 CD-ROMs. One of them I can mount the normal way, the other I can't. Both are ok according to debugfs and e2fsck and if I do
'mount -t ext2 -o loop /dev/cdrom /cdrom'
instead, both work.

The one that doesn't work have a blocksize of 1024 according to debugfs:
Block size = 1024, fragment size = 1024
And the other:
Block size = 4096, fragment size = 4096

What happens:

# mount -t ext2 /dev/cdrom /cdrom
mount: block device /dev/cdrom is write-protected, mounting read-only
mount: wrong fs type, bad option, bad superblock on /dev/cdrom,
or too many mounted file systems

kern.log:
Feb 18 14:54:34 pc1 kernel: VFS: Unsupported blocksize on dev sr(11,0).

I'm pretty sure both worked with 2.2.17.

You are being bitten by two bugs. By some coincidence I sent a patch for the first one to Linus and Alan yesterday.
(That was fs/ext2/super.c - the same bug occurs in both 2.2 and 2.4.) However, the second one will then still prevent you from mounting, and it occurs only in 2.4.

Someone has added

        /*
         * These are good guesses for the time being.
         */
        for (i = 0; i < sr_template.dev_max; i++) {
                sr_blocksizes[i] = 2048;
                sr_hardsizes[i] = 2048;
        }
        blksize_size[MAJOR_NR] = sr_blocksizes;
        hardsect_size[MAJOR_NR] = sr_hardsizes;

setting of hardsect_size to drivers/scsi/sr.c.

A value of hardsect_size[] means: this is the smallest size the hardware can work with. It is therefore a serious mistake just to come with "a good guess". This value is used only to reject impossible sizes, and everywhere the kernel accepts 0 meaning "don't know".

So, probably all will work fine if you change the second 2048 here to say 512 or 0. Or, if you, more drastically, remove all references to sr_hardsizes[] from sr.c.

Andries

#1 lore raw
Quoted 10 lines · On Sun, Feb 18 2001, [email protected] wrote:

Someone has added

        /*
         * These are good guesses for the time being.
         */
        for (i = 0; i < sr_template.dev_max; i++) {
                sr_blocksizes[i] = 2048;
                sr_hardsizes[i] = 2048;
        }
        blksize_size[MAJOR_NR] = sr_blocksizes;
        hardsect_size[MAJOR_NR] = sr_hardsizes;
Quoted 5 lines

setting of hardsect_size to drivers/scsi/sr.c.

A value of hardsect_size[] means: this is the smallest size the hardware can work with. It is therefore a serious mistake just to come with "a good guess". This value is used only

You are defeating the entire purpose of having a hardware sector size independently from the software block size. And 2kB is a valid guess, apart from the drives that do 512 byte transfers too 2kB is really the smallest transfer we can do.

Quoted 2 lines

to reject impossible sizes, and everywhere the kernel accepts 0 meaning "don't know".

So put 0 and sure anyone can submit I/O on the size that they want. Now the driver has to support padding reads, or gathering data to do a complete block write. This is silly. Sr should support 512b transfers just fine, but only because I added the necessary _hacks_ to support it. sd doesn't right now for instance.

In my oppinion we are always going to have hacks like this unless we add some generic support for < hardware submission of I/O. Simply ignoring this issue only makes it worse.

Signature · 1 line
Jens Axboe
#2 lore raw
Quoted 5 lines

So put 0 and sure anyone can submit I/O on the size that they want. Now the driver has to support padding reads, or gathering data to do a complete block write. This is silly. Sr should support 512b transfers just fine, but only because I added the necessary _hacks_ to support it. sd doesn't right now for instance.

It is silly to be in the block layer, it is silly to be in each file system. Perhaps it belongs in the block queueing/handling code or the caches

But it has to go somewhere, and 2.4 right now is unusable on two of my boxes with M/O drives.

#3 lore raw
In reply to Jens Axboe
Quoted 11 lines · Alan Cox
Quoted 5 lines

So put 0 and sure anyone can submit I/O on the size that they want. Now the driver has to support padding reads, or gathering data to do a complete block write. This is silly. Sr should support 512b transfers just fine, but only because I added the necessary _hacks_ to support it. sd doesn't right now for instance.

It is silly to be in the block layer, it is silly to be in each file system. Perhaps it belongs in the block queueing/handling code or the caches

But it has to go somewhere, and 2.4 right now is unusable on two of my boxes with M/O drives.

Reads can be pretty easily padded, but writes are a bit harder. Maybe push it to some helper before the device queue sees it? For 2.4 the best sd solution is probably to just make it able to handle these requests.

Signature · 1 line
Jens Axboe
#4 lore raw
Quoted 7 lines
Quoted 2 lines

But it has to go somewhere, and 2.4 right now is unusable on two of my boxes with M/O drives.

Reads can be pretty easily padded, but writes are a bit harder. Maybe push it to some helper before the device queue sees it? For 2.4 the best sd solution is probably to just make it able to handle these requests.

For M/O drives you can do it in the scsi layer. Doing it right in the block layer is not easy. Doing it cleanly and right I cant currently visualise a setu for. But I agree it belongs in the queueing layers