public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@zip.com.au>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: [patch] fix O_DIRECT oops
Date: Sun, 07 Jul 2002 16:10:53 -0700	[thread overview]
Message-ID: <3D28CA7D.9930E9F7@zip.com.au> (raw)


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;

-

                 reply	other threads:[~2002-07-07 23:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D28CA7D.9930E9F7@zip.com.au \
    --to=akpm@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox