• Andrew Morton's avatar
    [PATCH] Fix concurrent writepage and readpage · d58e41ee
    Andrew Morton authored
    Pages under writeback are not locked.  So it is possible (and quite
    legal) for a page to be under readpage() while it is still under
    writeback.  For a partially uptodate page with blocksize <
    PAGE_CACHE_SIZE.
    
    When this happens, the read and write I/O completion handlers get
    confused over the shared BH_Async usage and the page ends up not
    getting PG_writeback cleared.  Truncate gets stuck in D state.
    
    The patch separates the read and write I/O completion state.
    
    It also shuffles the buffer fields around.  Putting the
    commonly-accessed b_state at offset zero shrinks the kernel by a few
    hundred bytes because it can be accessed with indirect addressing, not
    indirect+indexed.
    d58e41ee
commit.c 21 KB