]> Pileus Git - ~andy/linux/commit
dm space map: disallow decrementing a reference count below zero
authorJoe Thornber <ejt@redhat.com>
Fri, 13 Dec 2013 12:31:08 +0000 (12:31 +0000)
committerMike Snitzer <snitzer@redhat.com>
Fri, 13 Dec 2013 19:22:09 +0000 (14:22 -0500)
commit5b564d80f8bc21094c0cd2b19b679d983aabcc29
tree942293da24619a5befb57d03e4a94db9b243710c
parent76f5bee5c3b45c617f91243e85547fc8f67bc678
dm space map: disallow decrementing a reference count below zero

The old behaviour, returning -EINVAL if a ref_count of 0 would be
decremented, was removed in commit f722063 ("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: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org # 3.12+
drivers/md/persistent-data/dm-space-map-common.c