Re: [PATCH] 2.6.10 - direct-io async short read bug

From: Badari Pulavarty
Date: Tue Mar 08 2005 - 12:29:39 EST


On Tue, 2005-03-08 at 01:09, Suparna Bhattacharya wrote:

>
> Hmm, shouldn't dio->result ideally have been adjusted to be within
> i_size at the time of io submission, so we don't have to deal with
> this during completion ? We are creating bios with the right size
> after all.
>
> We have this:
> if (!buffer_mapped(map_bh)) {
> ....
> if (dio->block_in_file >=
> i_size_read(dio->inode)>>blkbits) {
> /* We hit eof */
> page_cache_release(page);
> goto out;
> }
>

This check will catch only if there is no block on the disk. In the
current test case, the filesize = 3K and filesystem blocksize=4K.
So, we have a block (beyond filesize). The test tries to read 4K.
None of the checks catch this case and it submits 4K IO.

> and
> dio->result += iov[seg].iov_len -
> ((dio->final_block_in_request - dio->block_in_file) <<
> blkbits);
>
>
> can you spot what is going wrong here that we have to try and
> workaround this later ?


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.

Thanks,
Badari

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/