page->mapping == 0
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · Paul Mackerras
I am not any kind of expert on the page cache but it seems to me that maybe after locking the page we should check if it is still the page we want (i.e.
page->mappingandpage->indexare still correct), and go back and look up the page again if not. Presumably there will be quite a few places besidesdo_generic_file_readwhere that check would be needed also.
I'm getting at least some kind of clue about the page cache, though I don't claim to be an expert. You've pointed out how the operation of becoming a reader on a page can fail because the page disappears while you're waiting. That's an error, right? It's the result of a user space race, which in turn is the result of parallel processes doing nonatomic file operations with no synchronization. It sounds like bailing out of the file_read if the page turns out to be unmapped after the lock is the right thing to do, at least for a quick fix.
http://lxr.linux.no/source/mm/filemap.c?v=2.4.0-test9#L1029
There actually aren't that many places where lock_page is called:
http://lxr.linux.no/ident?v=2.4.0-test9;i=lock_page
Maybe lock_page needs to return an error code.
--
Daniel
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/