• Vivek Goyal's avatar
    ovl: Do not do metadata only copy-up for truncate operation · 997336f2
    Vivek Goyal authored
    truncate should copy up full file (and not do metacopy only), otherwise it
    will be broken.  For example, use truncate to increase size of a file so
    that any read beyong existing size will return null bytes.  If we don't
    copy up full file, then we end up opening lower file and read from it only
    reads upto the old size (and not new size after truncate).  Hence to avoid
    such situations, copy up data as well when file size changes.
    
    So far it was being done by d_real(O_WRONLY) call in truncate() path.  Now
    that patch has been reverted.  So force full copy up in ovl_setattr() if
    size of file is changing.
    Signed-off-by: default avatarVivek Goyal <vgoyal@redhat.com>
    Reviewed-by: default avatarAmir Goldstein <amir73il@gmail.com>
    Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
    997336f2
inode.c 24 KB