Re: [PATCH] VFS readahead bug in 2.6.8-rc[1-3]

From: Ram Pai
Date: Fri Aug 06 2004 - 12:52:11 EST


On Fri, 6 Aug 2004, Phillip Lougher wrote:

> Nick Piggin wrote:
> > Ram Pai wrote:
> >
> >>
> >> there is a check in __do_page_cache_readahead() that validates this.
> >> But it is still not guaranteed to work correctly against races.
> >> The filesystem has to handle such out-of-bound requests gracefully.
> >>
> >> However with Nick's fix in do_generic_mapping_read() the filesystem is
> >> gauranteed to be called with out-of-bound index, if the file size is a
> >> multiple of 4k. Without the fix, the filesystem might get
> >> called with out-of-bound index only in racy conditions.
> >>
> >
> > How's this?
> >
>
> It doesn't work. It correctly handles the case where *ppos is equal
> to i_size on entry to the function (and this does work for files 0, 4k
> and n * 4k in length), but it doesn't handle readahead inside the for
> loop. The check needs to be in the for loop.


Thinking of it more.. Is it not right to leave the code as is now?

That way all filesystems that cannot handle out-of-bound index access
are forcefully made to fix it. The filesystems anyway are not guaranteed
non-out-of-bound index access by the VFS.

RP
>
> -
> 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/
>

-
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/