• Vivek Goyal's avatar
    ovl: Fix ovl_getattr() to get number of blocks from lower · 67d756c2
    Vivek Goyal authored
    If an inode has been copied up metadata only, then we need to query the
    number of blocks from lower and fill up the stat->st_blocks.
    
    We need to be careful about races where we are doing stat on one cpu and
    data copy up is taking place on other cpu.  We want to return
    stat->st_blocks either from lower or stable upper and not something in
    between.  Hence, ovl_has_upperdata() is called first to figure out whether
    block reporting will take place from lower or upper.
    
    We now support metacopy dentries in middle layer.  That means number of
    blocks reporting needs to come from lowest data dentry and this could be
    different from lower dentry.  Hence we end up making a separate
    vfs_getxattr() call for metacopy dentries to get number of blocks.
    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>
    67d756c2
inode.c 23.8 KB