• Steve French's avatar
    cifs: fix data corruption in read after invalidate · a395726c
    Steve French authored
    When invalidating a file as part of breaking a lease, the folios holding
    the file data are disposed of, and truncate calls ->invalidate_folio()
    to get rid of them rather than calling ->release_folio().  This means
    that the netfs_inode::zero_point value didn't get updated in current
    upstream code to reflect the point after which we can assume that the
    server will only return zeroes, and future reads will then return blocks
    of zeroes if the file got extended for any region beyond the old zero
    point.
    
    Fix this by updating zero_point before invalidating the inode in
    cifs_revalidate_mapping().
    Suggested-by: default avatarDavid Howells <dhowells@redhat.com>
    Fixes: 3ee1a1fc ("cifs: Cut over to using netfslib")
    Reviewed-by: default avatarDavid Howells <dhowell@redhat.com>
    Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
    a395726c
inode.c 84.6 KB