Before this line of code cbt->count is always > 0 as it is: symmetrically incremented/decremented in this function under cbt->lock, and we are at the point just before decrementing it. This means that !cbt->count-- (note: postfix decrement returns value before operation) is always false and we never enter the true branch of this condition.
It seems the intent was to call release callbacks on reaching zero count, let's fix it. We have a cbt->cache percpu allocation leak detected by kmemleak, which might be caused by this uncalled release callback. https://jira.sw.ru/browse/PSBM-141114 Signed-off-by: Pavel Tikhomirov <ptikhomi...@virtuozzo.com> --- block/blk-cbt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-cbt.c b/block/blk-cbt.c index 04a9434b524a..2580ccabaa17 100644 --- a/block/blk-cbt.c +++ b/block/blk-cbt.c @@ -124,7 +124,7 @@ static int cbt_page_alloc(struct cbt_info **cbt_pp, unsigned long idx, if (in_rcu) rcu_read_lock(); spin_lock_irq(&cbt->lock); - if (unlikely(!cbt->count-- && test_bit(CBT_DEAD, &cbt->flags))) { + if (unlikely(!--(cbt->count) && test_bit(CBT_DEAD, &cbt->flags))) { spin_unlock_irq(&cbt->lock); call_rcu(&cbt->rcu, &cbt_release_callback); if (page) -- 2.37.3 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel