linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] scsicam_getgeo_odd_sector_size
@ 2004-08-19 23:02 brking
  2004-10-13 14:01 ` Brian King
  0 siblings, 1 reply; 8+ messages in thread
From: brking @ 2004-08-19 23:02 UTC (permalink / raw)
  To: James.Bottomley; +Cc: linux-scsi, brking


The following BUG() was observed when a scsi disk formatted to 522 bytes/sector
was discovered attached to a sym2 adapter.

<2>kernel BUG in grow_buffers at fs/buffer.c:1271!

which corresponds to:

static inline int
grow_buffers(struct block_device *bdev, sector_t block, int size)
{
        struct page *page;
        pgoff_t index;
        int sizebits;

        /* Size must be multiple of hard sectorsize */
        if (size & (bdev_hardsect_size(bdev)-1))
                BUG();
        if (size < 512 || size > PAGE_SIZE)
                BUG();                      <----- line 1271 is here


The following patch fixes this by not attempting to read the partition table
of a device with an unsupported sector size.


Signed-off-by: Brian King <brking@us.ibm.com>
---

 linux-2.6.8.1-bjking1/drivers/scsi/scsicam.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

diff -puN drivers/scsi/scsicam.c~scsicam_getgeo_odd_sector_size drivers/scsi/scsicam.c
--- linux-2.6.8.1/drivers/scsi/scsicam.c~scsicam_getgeo_odd_sector_size	2004-08-17 11:28:31.000000000 -0500
+++ linux-2.6.8.1-bjking1/drivers/scsi/scsicam.c	2004-08-17 11:33:13.000000000 -0500
@@ -29,7 +29,10 @@ unsigned char *scsi_bios_ptable(struct b
 	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));
+		struct buffer_head *bh = NULL;
+
+		if (get_capacity(bdev->bd_disk))
+			bh = __bread(bdev, 0, block_size(bdev));
 		if (bh) {
 			memcpy(res, bh->b_data + 0x1be, 66);
 			brelse(bh);
_

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-10-13 22:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-19 23:02 [PATCH 1/1] scsicam_getgeo_odd_sector_size brking
2004-10-13 14:01 ` Brian King
2004-10-13 14:04   ` Matthew Wilcox
2004-10-13 14:25     ` Brian King
2004-10-13 15:45       ` James Bottomley
2004-10-13 19:55         ` Brian King
2004-10-13 21:37           ` James Bottomley
2004-10-13 22:57             ` Brian King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).