From 74d61785e9a0abf6acc0d821968a9f00d8e28722 Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Fri, 19 Mar 2021 09:49:29 +0100 Subject: [PATCH] ocf_request: Deallocate request with separately allocated map properly When allocation of request with map fails, we fallback to allocating request with no map, and then allocate map separately. During request put we need to distinguish between those two cases in order to deallocate request properly. Signed-off-by: Robert Baldyga --- src/ocf_request.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ocf_request.c b/src/ocf_request.c index 0a7f291..6b0d849 100644 --- a/src/ocf_request.c +++ b/src/ocf_request.c @@ -204,8 +204,10 @@ void ocf_req_put(struct ocf_request *req) if (!req->d2c && req->io_queue != req->cache->mngt_queue) ocf_refcnt_dec(&req->cache->refcnt.metadata); - if (!env_mpool_del(req->cache->owner->resources.req, req, - req->core_line_count)) { + if (req->map == req->__map) { + env_mpool_del(req->cache->owner->resources.req, req, + req->core_line_count); + } else { env_free(req->map); env_mpool_del(req->cache->owner->resources.req, req, 1); }