• Andrew Morton's avatar
    [PATCH] fix ext3 race with writeback · 5409c2b5
    Andrew Morton authored
    The ext3-no-steal patch has exposed a long-standing race in ext3.  It
    has been there all the time in 2.4, but never triggered until some
    timing change in the ext3-no-steal patch exposed it.  The race was not
    present in 2.2 because 2.2's bdflush runs inside lock_kernel().
    
    The problem is that when ext3 is shuffling a buffer between journalling
    lists there is a small window where the buffer is marked BH_dirty.
    Aonther CPU can grab it, mark it clean and write it out.  Then ext3
    puts the buffer onto a list of buffers which are expected to be dirty,
    and gets confused later on when the buffer turns out to be clean.
    
    The patch from Stephen records the expected dirtiness of the buffer in
    a local variable, so BH_dirty is not transiently set while ext3
    shuffles.
    5409c2b5
transaction.c 60.4 KB