mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nathan Scott <nathans@sgi.com>
To: Badari Pulavarty <pbadari@us.ibm.com>
Cc: Ralf Hildebrandt <Ralf.Hildebrandt@charite.de>,
	lkml <linux-kernel@vger.kernel.org>,
	linux-xfs@oss.sgi.com
Subject: Re: kernel BUG at fs/direct-io.c:916!
Date: Wed, 29 Mar 2006 08:23:45 +1000	[thread overview]
Message-ID: <20060329082345.G871924@wobbly.melbourne.sgi.com> (raw)
In-Reply-To: <1143567049.26106.2.camel@dyn9047017100.beaverton.ibm.com>; from pbadari@us.ibm.com on Tue, Mar 28, 2006 at 09:30:44AM -0800

On Tue, Mar 28, 2006 at 09:30:44AM -0800, Badari Pulavarty wrote:
> Thanks for working this out. You may want to add a description
> to the patch. Like:
> 
> "inode->i_blkbits should be used instead of dio->blkbits, as
> it may not indicate the filesystem block size all the time".

Will do, thanks.  Oh, another thing - what is the situation
where a NULL bdev would be passed into __blockdev_direct_IO?
All the filesystems seem to pass i_sb->s_bdev, so I guess it
must be blkdev_direct_IO - can I_BDEV(inode) ever be NULL on
a block device inode (doesn't sound right)?  If it cannot, I
suppose we should remove those NULL bdev checks too...

cheers.

-- 
Nathan


Index: xfs-linux-2.6/fs/direct-io.c
===================================================================
--- xfs-linux-2.6.orig/fs/direct-io.c
+++ xfs-linux-2.6/fs/direct-io.c
@@ -1186,8 +1186,8 @@ __blockdev_direct_IO(int rw, struct kioc
 	size_t size;
 	unsigned long addr;
 	unsigned blkbits = inode->i_blkbits;
-	unsigned bdev_blkbits = 0;
 	unsigned blocksize_mask = (1 << blkbits) - 1;
+	unsigned bdev_blkbits = blksize_bits(bdev_hardsect_size(bdev));
 	ssize_t retval = -EINVAL;
 	loff_t end = offset;
 	struct dio *dio;
@@ -1197,12 +1197,8 @@ __blockdev_direct_IO(int rw, struct kioc
 	if (rw & WRITE)
 		current->flags |= PF_SYNCWRITE;
 
-	if (bdev)
-		bdev_blkbits = blksize_bits(bdev_hardsect_size(bdev));
-
 	if (offset & blocksize_mask) {
-		if (bdev)
-			 blkbits = bdev_blkbits;
+		blkbits = bdev_blkbits;
 		blocksize_mask = (1 << blkbits) - 1;
 		if (offset & blocksize_mask)
 			goto out;
@@ -1214,8 +1210,7 @@ __blockdev_direct_IO(int rw, struct kioc
 		size = iov[seg].iov_len;
 		end += size;
 		if ((addr & blocksize_mask) || (size & blocksize_mask))  {
-			if (bdev)
-				 blkbits = bdev_blkbits;
+			blkbits = bdev_blkbits;
 			blocksize_mask = (1 << blkbits) - 1;
 			if ((addr & blocksize_mask) || (size & blocksize_mask))  
 				goto out;

  reply	other threads:[~2006-03-28 22:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20060326230206.06C1EE083AAB@knarzkiste.dyndns.org>
2006-03-26 18:04 ` Ralf Hildebrandt
2006-03-26 18:46   ` Ralf Hildebrandt
2006-03-26 22:08     ` Nathan Scott
2006-03-26 23:03       ` Ralf Hildebrandt
2006-03-27  5:33         ` Nathan Scott
     [not found]         ` <20060327060436.GC2481@frodo>
     [not found]           ` <20060327110342.GX21946@charite.de>
2006-03-28  5:01             ` Nathan Scott
2006-03-28 11:28               ` Ralf Hildebrandt
2006-03-28 21:43                 ` Nathan Scott
2006-03-29  8:35                   ` Ralf Hildebrandt
2006-03-28 17:30               ` Badari Pulavarty
2006-03-28 22:23                 ` Nathan Scott [this message]
2006-03-30 18:42                   ` Badari Pulavarty

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=20060329082345.G871924@wobbly.melbourne.sgi.com \
    --to=nathans@sgi.com \
    --cc=Ralf.Hildebrandt@charite.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@oss.sgi.com \
    --cc=pbadari@us.ibm.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

all inboxes | Powered by JetHome®