• Andrew Morton's avatar
    [PATCH] Fix generic_file_write() again. · b7651add
    Andrew Morton authored
    From: "Milton D. Miller II" <miltonm@realtime.net>
    
    The code at present has a small problem: when a fault is encountered we will
    run commit_write() to cover the amount of data which was successfully copied
    in from userspace.
    
    But filemap_copy_from_user() may have zeroed out some more of the page.  So
    pagecache now has zeroes and the buffer_head which represents those zeroes is
    not dirtied.  So a subsequent eviction and re-read of the file in the window
    beyond the faulting offset will return the file's old contents and not the
    zeroes.
    
    So we change filemap_copy_from_user_iovec() to have the same behaviour as the
    non-iovec filemap_copy_from_user(), and ensure that the commit_write() covers
    the parts of the page which copy_from_user() zeroed out.
    b7651add
filemap.c 46 KB