public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] fix O_DIRECT oops
@ 2002-07-07 23:10 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2002-07-07 23:10 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: lkml


inode->i_sb->s_bdev is NULL when the inode refers to a blockdev.
Use the get_block() result instead.


 buffer.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

--- 2.5.25/fs/buffer.c~direct_io-fix	Sun Jul  7 04:00:23 2002
+++ 2.5.25-akpm/fs/buffer.c	Sun Jul  7 04:01:38 2002
@@ -2302,8 +2302,9 @@ int generic_direct_IO(int rw, struct ino
 			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 */
@@ -2333,11 +2334,12 @@ int generic_direct_IO(int rw, struct ino
 				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;

-

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-07-07 23:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-07 23:10 [patch] fix O_DIRECT oops Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox