[Devel] [PATCH RHEL7 COMMIT] blk-cbt: fix in_use check in blk_cbt_release
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Nov 3 22:46:32 MSK 2022
The commit is pushed to "branch-rh7-3.10.0-1160.76.1.vz7.189.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.76.1.vz7.189.7
------>
commit 780dad116d89430d5f28ace0476f58280d0df441
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 2580ccabaa17..054c73c6ef9f 100644
--- a/block/blk-cbt.c
+++ b/block/blk-cbt.c
@@ -540,7 +540,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