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

From: Phillip Lougher
Date: Fri Aug 06 2004 - 12:18:14 EST


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.

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