• Andrew Morton's avatar
    [PATCH] don't allow background writes to hide dirty buffers · bd134f27
    Andrew Morton authored
    If pdflush hits a locked-and-clean buffer in __block_write_full_page() it
    will just pass over the buffer.  Typically the buffer is an ext3 data=ordered
    buffer which is being written by kjournald, but a similar thing can happen
    with blockdev buffers and ll_rw_block().
    
    This is bad because the buffer is still under I/O and a subsequent fsync's
    fdatawait() needs to know about it.
    
    It is not practical to tag the page for writeback - only the submitter of the
    I/O can do that, because the submitter has control of the end_io handler.
    
    So instead, redirty the page so a subsequent fsync's fdatawrite() will wait on
    the underway I/O.
    
    There is a risk that pdflush::background_writeout() will lock up, repeatedly
    trying and failing to write the same page.  This is prevented by ensuring
    that background_writeout() always throttles when it made no progress.
    bd134f27
buffer.c 80.1 KB