From: Andrew Morton Signed-off-by: Andrew Morton --- fs/buffer.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff -puN fs/buffer.c~getblk-handle-2tb-devices fs/buffer.c --- a/fs/buffer.c~getblk-handle-2tb-devices +++ a/fs/buffer.c @@ -1136,6 +1136,20 @@ __getblk_slow(struct block_device *bdev, return NULL; } +#if (BITS_PER_LONG == 32) && defined(CONFIG_LBD) + if ((block >> (PAGE_CACHE_SHIFT - bdev->bd_inode->i_blkbits)) & + 0xffffffff00000000UL) { + /* + * We'll fail because the block is outside the range + * which a 32-bit pagecache index can address + */ + printk(KERN_ERR "getblk(): sector number too large for 32-bit" + "machines\n"); + dump_stack(); + return NULL; + } +#endif + for (;;) { struct buffer_head * bh; int ret; _