lkml.org 
[lkml]   [2000]   [Oct]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: page->mapping == 0
    Date
    Paul Mackerras wrote:
    > 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->mapping and page->index are still correct), and go
    > back and look up the page again if not. Presumably there will be
    > quite a few places besides do_generic_file_read where 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 majordomo@vger.kernel.org
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 12:45    [W:0.022 / U:62.396 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site