Skip to content
  • Nick Piggin's avatar
    mm: write_cache_pages writepage error fix · 00266770
    Nick Piggin authored
    
    
    In write_cache_pages, if ret signals a real error, but we still have some
    pages left in the pagevec, done would be set to 1, but the remaining pages
    would continue to be processed and ret will be overwritten in the process.
    
    It could easily be overwritten with success, and thus success will be
    returned even if there is an error.  Thus the caller is told all writes
    succeeded, wheras in reality some did not.
    
    Fix this by bailing immediately if there is an error, and retaining the
    first error code.
    
    This is a data integrity bug.
    
    Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
    Cc: Chris Mason <chris.mason@oracle.com>
    Cc: Dave Chinner <david@fromorbit.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    00266770