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

[PATCH] fix O_DIRECT oops

inode->i_sb->s_bdev is NULL when the inode refers to a blockdev.
Use the get_block() result instead.
parent 42ec8bc1
......@@ -2316,8 +2316,9 @@ int generic_direct_IO(int rw, struct inode *inode,
struct kiobuf *iobuf, unsigned long blocknr,
int blocksize, get_block_t *get_block)
{
int i, nr_blocks, retval;
int i, nr_blocks, retval = 0;
sector_t *blocks = iobuf->blocks;
struct block_device *bdev = NULL;
nr_blocks = iobuf->length / blocksize;
/* build the blocklist */
......@@ -2347,11 +2348,12 @@ int generic_direct_IO(int rw, struct inode *inode,
BUG();
}
blocks[i] = bh.b_blocknr;
bdev = bh.b_bdev;
}
/* This does not understand multi-device filesystems currently */
retval = brw_kiovec(rw, 1, &iobuf,
inode->i_sb->s_bdev, blocks, blocksize);
if (bdev)
retval = brw_kiovec(rw, 1, &iobuf, bdev, blocks, blocksize);
out:
return retval;
......
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