Commit bd105032 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] getblk() BUG removal

We keep on getting BUG()s from isofs_read_super() because it passes an insane
blocksize to bread().  See http://bugme.osdl.org/show_bug.cgi?id=2735 for
example.

I don't know what's up with isofs, but going BUG in there seems a bit rude.
Change it to drop a bunch of diagnostics and a backtrace then return a null
bh*.

Most callers of getblk() don't expect it to fail, so they'll oops anyway.  But
isofs does actually check for a NULL return.  This way, the machine stays up
and we get better debug diagnostics.
parent 83804118
...@@ -1263,12 +1263,6 @@ grow_buffers(struct block_device *bdev, sector_t block, int size) ...@@ -1263,12 +1263,6 @@ grow_buffers(struct block_device *bdev, sector_t block, int size)
pgoff_t index; pgoff_t index;
int sizebits; int sizebits;
/* Size must be multiple of hard sectorsize */
if (size & (bdev_hardsect_size(bdev)-1))
BUG();
if (size < 512 || size > PAGE_SIZE)
BUG();
sizebits = -1; sizebits = -1;
do { do {
sizebits++; sizebits++;
...@@ -1289,6 +1283,18 @@ grow_buffers(struct block_device *bdev, sector_t block, int size) ...@@ -1289,6 +1283,18 @@ grow_buffers(struct block_device *bdev, sector_t block, int size)
struct buffer_head * struct buffer_head *
__getblk_slow(struct block_device *bdev, sector_t block, int size) __getblk_slow(struct block_device *bdev, sector_t block, int size)
{ {
/* Size must be multiple of hard sectorsize */
if (unlikely(size & (bdev_hardsect_size(bdev)-1) ||
(size < 512 || size > PAGE_SIZE))) {
printk(KERN_ERR "getblk(): invalid block size %d requested\n",
size);
printk(KERN_ERR "hardsect size: %d\n",
bdev_hardsect_size(bdev));
dump_stack();
return NULL;
}
for (;;) { for (;;) {
struct buffer_head * bh; struct buffer_head * bh;
......
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