--- linux-pure/fs/block_dev.c.1 2003-10-24 02:10:36.000000000 +0200 +++ linux-pure/fs/block_dev.c 2003-10-24 02:12:38.000000000 +0200 @@ -151,9 +151,21 @@ static int blkdev_get_block(struct inode * inode, long iblock, struct buffer_head * bh, int create) { + unsigned long lblock; if (iblock >= max_block(inode->i_rdev)) return -EIO; + /* + * are we trying to get_block a partial block at the end of the + * device? If reading, just return an unmapped hole. If + * writing send -EIO. + */ + lblock = i_size_read(inode) >> inode->i_blkbits; + if (iblock >= lblock) { + if (create) + return -EIO; + return 0; + } bh->b_dev = inode->i_rdev; bh->b_blocknr = iblock; bh->b_state |= 1UL << BH_Mapped;