• Joe Thornber's avatar
    dm space map: disallow decrementing a reference count below zero · 5b564d80
    Joe Thornber authored
    The old behaviour, returning -EINVAL if a ref_count of 0 would be
    decremented, was removed in commit f722063e ("dm space map: optimise
    sm_ll_dec and sm_ll_inc").  To fix this regression we return an error
    code from the mutator function pointer passed to sm_ll_mutate() and have
    dec_ref_count() return -EINVAL if the old ref_count is 0.
    
    Add a DMERR to reflect the potential seriousness of this error.
    
    Also, add missing dm_tm_unlock() to sm_ll_mutate()'s error path.
    
    With this fix the following dmts regression test now passes:
     dmtest run --suite cache -n /metadata_use_kernel/
    
    The next patch fixes the higher-level dm-array code that exposed this
    regression.
    Signed-off-by: default avatarJoe Thornber <ejt@redhat.com>
    Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
    Cc: stable@vger.kernel.org # 3.12+
    5b564d80
dm-space-map-common.c 16.7 KB