From: Badari Pulavarty <pbadari@us.ibm.com>
To: suparna@in.ibm.com
Cc: "Andrew Morton" <akpm@osdl.org>,
"Sébastien Dugué" <sebastien.dugue@bull.net>,
"linux-aio@kvack.org" <linux-aio@kvack.org>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] 2.6.10 - direct-io async short read bug
Date: 08 Mar 2005 11:18:28 -0800 [thread overview]
Message-ID: <1110309508.24286.74.camel@dyn318077bld.beaverton.ibm.com> (raw)
In-Reply-To: <1110302614.24286.61.camel@dyn318077bld.beaverton.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 791 bytes --]
> Andrew, please don't apply the original patch. We shouldn't even attempt
> to submit IO beyond the filesize. We should truncate the IO request to
> filesize. I will send a patch today to fix this.
>
Well, spoke too soon. This is an ugly corner case :( But I have
a ugly hack to fix it :)
Let me ask you a basic question: Do we support DIO reads on a file
which is not blocksize multiple in size ? (say 12K - 10 bytes) ?
What about the ones which are not 4K but 512 byte multiple ? (say 7K) ?
I need answer to those, to figure out how hard I should try to fix this.
Anyway, here is ugly version of the patch - which will limit the IO
size to filesize and uses lower blocksizes to read the file (since
the filesize is only 3K, it would go down to 512 byte blocksize).
Thanks,
Badari
[-- Attachment #2: aio-dio-short-read.patch --]
[-- Type: text/plain, Size: 921 bytes --]
--- fs/direct-io.c.org 2005-03-08 09:53:31.823761712 -0800
+++ fs/direct-io.c 2005-03-08 12:09:33.280084600 -0800
@@ -1180,6 +1180,22 @@ __blockdev_direct_IO(int rw, struct kioc
addr = (unsigned long)iov[seg].iov_base;
size = iov[seg].iov_len;
end += size;
+
+ /*
+ * If we are trying to read beyond end of the file
+ * truncate the IO request to filesize.
+ * This is ugly: we change iov_len and nr_segs,
+ * but need to do this here since we may need to
+ * bail out if the filesize is not blocksize multiple
+ * and we may need to do fine-grain blocksizes.
+ */
+ if ((rw == READ) && (end > i_size_read(inode))) {
+ iov[seg].iov_len -= (end - i_size_read(inode));
+ size = iov[seg].iov_len;
+ end = i_size_read(inode);
+ nr_segs = seg + 1; /* Ugly - to break the loop */
+ }
+
if ((addr & blocksize_mask) || (size & blocksize_mask)) {
if (bdev)
blkbits = bdev_blkbits;
next prev parent reply other threads:[~2005-03-08 19:29 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-07 10:00 Sébastien Dugué
2005-03-08 6:39 ` Andrew Morton
2005-03-08 9:09 ` Suparna Bhattacharya
2005-03-08 9:18 ` Andrew Morton
2005-03-08 9:41 ` Suparna Bhattacharya
2005-03-08 9:41 ` Andrew Morton
2005-03-08 10:27 ` Suparna Bhattacharya
2005-03-08 10:27 ` Andrew Morton
2005-03-08 17:23 ` Badari Pulavarty
2005-03-08 19:18 ` Badari Pulavarty [this message]
2005-03-08 23:27 ` Daniel McNeil
2005-03-08 23:54 ` Badari Pulavarty
2005-03-09 4:07 ` Joel Becker
2005-03-09 9:50 ` Sébastien Dugué
2005-03-09 15:20 ` Suparna Bhattacharya
2005-03-09 19:53 ` Andrew Morton
2005-03-09 21:18 ` Joel Becker
2005-03-09 21:31 ` Badari Pulavarty
2005-03-09 22:39 ` Andrew Morton
2005-03-09 22:45 ` Badari Pulavarty
2005-03-09 1:44 ` Daniel McNeil
2005-03-09 15:58 ` Badari Pulavarty
2005-03-08 9:46 Sébastien Dugué
2005-03-08 10:16 Sébastien Dugué
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=1110309508.24286.74.camel@dyn318077bld.beaverton.ibm.com \
--to=pbadari@us.ibm.com \
--cc=akpm@osdl.org \
--cc=linux-aio@kvack.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sebastien.dugue@bull.net \
--cc=suparna@in.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®