Commit c7014083 authored by James Bottomley's avatar James Bottomley Committed by James Bottomley

SCSI: Fix problems with non-power-of-two sector size discs

We can't support them, but the system should disable them cleanly
and continue when they're detected (at the moment it
dumps a stack trace).

The fix (hack) is to set them to zero size and 512 byte
sectors.  This means they're still amenable to ioctls (like
to reformat them with a useful block size) but cannot
be read from or written to.
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 3bee45fa
......@@ -29,10 +29,11 @@ unsigned char *scsi_bios_ptable(struct block_device *dev)
unsigned char *res = kmalloc(66, GFP_KERNEL);
if (res) {
struct block_device *bdev = dev->bd_contains;
struct buffer_head *bh = __bread(bdev, 0, block_size(bdev));
if (bh) {
memcpy(res, bh->b_data + 0x1be, 66);
brelse(bh);
Sector sect;
void *data = read_dev_sector(bdev, 0, &sect);
if (data) {
memcpy(res, data + 0x1be, 66);
put_dev_sector(sect);
} else {
kfree(res);
res = NULL;
......
......@@ -1125,6 +1125,13 @@ sd_read_capacity(struct scsi_disk *sdkp, char *diskname,
* For this reason, we leave the thing in the table.
*/
sdkp->capacity = 0;
/*
* set a bogus sector size so the normal read/write
* logic in the block layer will eventually refuse any
* request on this device without tripping over power
* of two sector size assumptions
*/
sector_size = 512;
}
{
/*
......
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