Hi,
At the moment, it seems that the read_cache_page() can potentially
leave your page cache full of non-uptodate pages, since an error by
the filler routine doesn't cause the page to get removed from the
cache. Instead it is left as-is in an undefined state.
The question is, whether one should correct this in the VFS, and if
so, how?
It seems to me that for the code in page_getlink() there is nothing
to be gained by repeatedly dropping the page and/or rereading the
screwed up symlink, since (barring divine intervention) an error is
unlikely to correct itself.
For (NFS|smb|..), however, the problem may be a credential issue, a
soft mount, s//1000 other reasons/ ... and hence trying to reload the
cache makes sense.
I'd therefore propose that we add something like the appended function
to mm/filemap.c as a drop-in replacement for read_page_cache() for the
benefit of those who may need it.
Comments?
Cheers,
Trond
struct page *update_cache_page(struct address_space *mapping,
unsigned long index,
int (*filler)(void *,struct page*),
void *data)
{
struct page *page = read_cache_page(mapping, index, filler,
data);
int err;
if (IS_ERR(page) || Page_Uptodate(page))
goto out;
lock_page(page);
if (Page_Uptodate(page)) {
UnlockPage(page);
goto out;
}
err = filler(data, page);
if (err < 0) {
page_cache_release(page);
page = ERR_PTR(err);
}
out:
return page;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Tue May 23 2000 - 21:00:11 EST