[Devel] [PATCH RHEL7 COMMIT] fuse kio: Use kmem_cache_free() instead of kfree()

Konstantin Khorenko khorenko at virtuozzo.com
Tue Aug 14 19:39:52 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.9.1.vz7.70.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.9.1.vz7.70.5
------>
commit 4c1a67e80bb4521142b4de754e554ad56aa3bdc9
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Tue Aug 14 19:39:52 2018 +0300

    fuse kio: Use kmem_cache_free() instead of kfree()
    
    Objects allocated via kmem_cache_alloc() must be freed
    with appropriate primitive.
    
    Fixes: 4d9a54225327 ("fuse kio: Allocate pcs_map from kmem_cache with
    SLAB_RECLAIM_ACCOUNT flag")
    
    https://jira.sw.ru/browse/PSBM-87665
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    Reviewed-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_map.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/fuse/kio/pcs/pcs_map.c b/fs/fuse/kio/pcs/pcs_map.c
index ebba23546c94..d91501a26204 100644
--- a/fs/fuse/kio/pcs/pcs_map.c
+++ b/fs/fuse/kio/pcs/pcs_map.c
@@ -118,7 +118,7 @@ static void pcs_map_callback(struct rcu_head *head)
 	BUG_ON(!(m->state & PCS_MAP_DEAD));
 	BUG_ON(m->cs_list);
 
-	kfree(m);
+	kmem_cache_free(pcs_map_cachep, m);
 }
 
 static void __pcs_map_free(struct pcs_map_entry *m)
@@ -564,7 +564,7 @@ struct pcs_map_entry * pcs_find_get_map(struct pcs_dentry_info *di, u64 offset)
 		return NULL;
 
 	if (radix_tree_preload(GFP_NOIO)) {
-		kfree(m);
+		kmem_cache_free(pcs_map_cachep, m);
 		return NULL;
 	}
 
@@ -596,7 +596,7 @@ struct pcs_map_entry * pcs_find_get_map(struct pcs_dentry_info *di, u64 offset)
 		m->mapping->nrmaps--;
 		spin_unlock(&di->mapping.map_lock);
 		radix_tree_preload_end();
-		kfree(m);
+		kmem_cache_free(pcs_map_cachep, m);
 		goto again;
 	}
 	spin_unlock(&di->mapping.map_lock);


More information about the Devel mailing list