• Andrea Arcangeli's avatar
    [PATCH] writepage fs corruption fix · 8d4261a0
    Andrea Arcangeli authored
    Fix a data loss bug in mpage_writepages(), triggerable under extreme memory
    pressure on ext2, JFS, hfs and hfsplus:
    
    The bug is the marking of the bh clean despite we could still run into the
    "confused" path.  After that the confused path really becomes confused and it
    writes nothing and fs corruption triggers silenty (the reugular writepage only
    writes bh that are marked dirty, it never attempts to submit_bh anything
    marked clean).  The mpage-writepage code must never mark the bh clean as far
    as it wants to still fallback in the regular writepage which depends on the bh
    to be dirty (i.e.  the "goto confused" path).  This could only triggers with
    memory pressure (it also needs buffer_heads_over_limit == 0, and that is
    frequent under mm pressure).
    
    Thanks a lot to Chris for his fine debugging that localized the problem in the
    writepage code.
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    8d4261a0
mpage.c 19 KB