Messages in this thread | | | Subject | Re: [PATCH] VFS readahead bug in 2.6.8-rc[1-3] | From | Ram <> | Date | 06 Aug 2004 03:47:50 -0700 |
| |
On Thu, 2004-08-05 at 23:19, 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?
If I understand your patch correctly: it takes care of files whose size is 0 bytes, but not files of size 4k bytes or 8k bytes. or .. n*4k bytes
I think the original check that you removed should be reverted back and the additional check that you introduced should remain.
RP > > --- > > linux-2.6-npiggin/mm/filemap.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff -puN mm/filemap.c~fs-fix mm/filemap.c > --- linux-2.6/mm/filemap.c~fs-fix 2004-08-06 16:16:26.000000000 +1000 > +++ linux-2.6-npiggin/mm/filemap.c 2004-08-06 16:18:22.000000000 +1000 > @@ -716,9 +716,9 @@ void do_generic_mapping_read(struct addr > offset = *ppos & ~PAGE_CACHE_MASK; > > isize = i_size_read(inode); > - end_index = isize >> PAGE_CACHE_SHIFT; > - if (index > end_index) > + if (*ppos >= isize) > goto out; > + end_index = isize >> PAGE_CACHE_SHIFT; > > for (;;) { > struct page *page; > > _
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |