• Qi Zheng's avatar
    NFSv4.2: fix wrong shrinker_id · 7f7ab336
    Qi Zheng authored
    Currently, the list_lru::shrinker_id corresponding to the nfs4_xattr
    shrinkers is wrong:
    
    >>> prog["nfs4_xattr_cache_lru"].shrinker_id
    (int)0
    >>> prog["nfs4_xattr_entry_lru"].shrinker_id
    (int)0
    >>> prog["nfs4_xattr_large_entry_lru"].shrinker_id
    (int)0
    >>> prog["nfs4_xattr_cache_shrinker"].id
    (int)18
    >>> prog["nfs4_xattr_entry_shrinker"].id
    (int)19
    >>> prog["nfs4_xattr_large_entry_shrinker"].id
    (int)20
    
    This is not what we expect, which will cause these shrinkers
    not to be found in shrink_slab_memcg().
    
    We should assign shrinker::id before calling list_lru_init_memcg(),
    so that the corresponding list_lru::shrinker_id will be assigned
    the correct value like below:
    
    >>> prog["nfs4_xattr_cache_lru"].shrinker_id
    (int)16
    >>> prog["nfs4_xattr_entry_lru"].shrinker_id
    (int)17
    >>> prog["nfs4_xattr_large_entry_lru"].shrinker_id
    (int)18
    >>> prog["nfs4_xattr_cache_shrinker"].id
    (int)16
    >>> prog["nfs4_xattr_entry_shrinker"].id
    (int)17
    >>> prog["nfs4_xattr_large_entry_shrinker"].id
    (int)18
    
    So just do it.
    
    Fixes: 95ad37f9 ("NFSv4.2: add client side xattr caching.")
    Signed-off-by: default avatarQi Zheng <zhengqi.arch@bytedance.com>
    Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
    7f7ab336
nfs42xattr.c 25.6 KB