[Devel] [PATCH RHEL9 COMMIT] blk-cbt: fix in_use check in blk_cbt_release
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Nov 3 22:47:49 MSK 2022
The commit is pushed to "branch-rh9-5.14.0-70.22.1.vz9.17.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-70.22.1.vz9.17.8
------>
commit e9eddec3e0a64bf40368a8d179f85e877811a72a
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date: Wed Nov 2 11:53:28 2022 +0300
blk-cbt: fix in_use check in blk_cbt_release
Calling cpt_release_callback on cbt->count != 0 here is really strange
because cbt_page_alloc would anyway do it on decrementing count to zero,
but in opposite case where cbt->count == 0 we should call the callback
but we do not, let's fix it by reversing the condition.
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 <ptikhomirov at virtuozzo.com>
Feature: cbt: changed block tracking (for backup)
---
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 d510838baba1..c7cf7b0ae264 100644
--- a/block/blk-cbt.c
+++ b/block/blk-cbt.c
@@ -687,7 +687,7 @@ void blk_cbt_release(struct request_queue *q)
rcu_assign_pointer(q->cbt, NULL);
in_use = cbt->count;
spin_unlock(&cbt->lock);
- if (in_use)
+ if (!in_use)
call_rcu(&cbt->rcu, &cbt_release_callback);
}
More information about the Devel
mailing list