• Curt Wohlgemuth's avatar
    ext4: don't set PageUptodate in ext4_end_bio() · 39db00f1
    Curt Wohlgemuth authored
    In the bio completion routine, we should not be setting
    PageUptodate at all -- it's set at sys_write() time, and is
    unaffected by success/failure of the write to disk.
    
    This can cause a page corruption bug when the file system's
    block size is less than the architecture's VM page size.
    
    if we have only written a single block -- we might end up
    setting the page's PageUptodate flag, indicating that page
    is completely read into memory, which may not be true.
    This could cause subsequent reads to get bad data.
    
    This commit also takes the opportunity to clean up error
    handling in ext4_end_bio(), and remove some extraneous code:
    
       - fixes ext4_end_bio() to set AS_EIO in the
         page->mapping->flags on error, which was left out by
         mistake.  This is needed so that fsync() will
         return an error if there was an I/O error.
       - remove the clear_buffer_dirty() call on unmapped
         buffers for each page.
       - consolidate page/buffer error handling in a single
         section.
    Signed-off-by: default avatarCurt Wohlgemuth <curtw@google.com>
    Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
    Reported-by: default avatarJim Meyering <jim@meyering.net>
    Reported-by: default avatarHugh Dickins <hughd@google.com>
    Cc: Mingming Cao <cmm@us.ibm.com>
    39db00f1
page-io.c 10.3 KB