From 0ec38141b82fef8dc7ade8d52c59c64985ddff00 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 4 Nov 2018 04:30:44 +0000 Subject: [PATCH] Merge r7449 from trunk git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.3.x@7702 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/isert-scst/iser_global.c | 6 ++---- scst/src/scst_main.c | 16 +--------------- scst/src/scst_mem.c | 13 +++++++++---- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/iscsi-scst/kernel/isert-scst/iser_global.c b/iscsi-scst/kernel/isert-scst/iser_global.c index a7882c7b2..cee6398a0 100644 --- a/iscsi-scst/kernel/isert-scst/iser_global.c +++ b/iscsi-scst/kernel/isert-scst/iser_global.c @@ -144,10 +144,8 @@ int isert_global_init(void) return -ENOMEM; } - isert_cmnd_cache = kmem_cache_create_usercopy("isert_cmnd", - sizeof(struct isert_cmnd), __alignof__(struct isert_cmnd), - SCST_SLAB_FLAGS | SLAB_HWCACHE_ALIGN, - 0, sizeof(struct isert_cmnd), NULL); + isert_cmnd_cache = KMEM_CACHE(isert_cmnd, + SCST_SLAB_FLAGS|SLAB_HWCACHE_ALIGN); if (!isert_cmnd_cache) { destroy_workqueue(isert_glob.conn_wq); PRINT_ERROR("Failed to alloc iser command cache"); diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 0a0149ed3..3c0173272 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -2579,20 +2579,6 @@ static int __init init_scst(void) (p); \ }) -/* - * Used for structures with fast path write access accessed from user space. - * See also commit 8eb8284b4129 ("usercopy: Prepare for usercopy whitelisting"). - */ -#define INIT_CACHEP_ALIGN_USERCOPY(p, s) ({ \ - (p) = kmem_cache_create_usercopy(#s, sizeof(struct s), \ - __alignof__(struct s), \ - SCST_SLAB_FLAGS | SLAB_HWCACHE_ALIGN, \ - 0, sizeof(struct s), NULL); \ - TRACE_MEM("Slab create: %s at %p size %zd", #s, (p), \ - sizeof(struct s)); \ - (p); \ - }) - res = -ENOMEM; if (!INIT_CACHEP(scst_mgmt_cachep, scst_mgmt_cmd)) goto out_lib_exit; @@ -2607,7 +2593,7 @@ static int __init init_scst(void) } if (!INIT_CACHEP(scst_aen_cachep, scst_aen)) /* read-mostly */ goto out_destroy_sense_cache; - if (!INIT_CACHEP_ALIGN_USERCOPY(scst_cmd_cachep, scst_cmd)) + if (!INIT_CACHEP_ALIGN(scst_cmd_cachep, scst_cmd)) goto out_destroy_aen_cache; #ifdef CONFIG_SCST_MEASURE_LATENCY if (!INIT_CACHEP_ALIGN(scst_sess_cachep, scst_session)) diff --git a/scst/src/scst_mem.c b/scst/src/scst_mem.c index 4070a0c85..f6f2b924a 100644 --- a/scst/src/scst_mem.c +++ b/scst/src/scst_mem.c @@ -1374,10 +1374,15 @@ static void sgv_pool_init_cache(struct sgv_pool *pool, int cache_num, scnprintf(pool->cache_names[cache_num], sizeof(pool->cache_names[cache_num]), "%s-%uK", pool->name, (pages << PAGE_SHIFT) >> 10); - pool->caches[cache_num] = kmem_cache_create_usercopy( - pool->cache_names[cache_num], size, 0/*align*/, per_cpu ? - SCST_SLAB_FLAGS : SCST_SLAB_FLAGS | SLAB_HWCACHE_ALIGN, - 0/*useroffset*/, size/*usersize*/, NULL); + pool->caches[cache_num] = kmem_cache_create( + pool->cache_names[cache_num], size, + 0, per_cpu ? SCST_SLAB_FLAGS : + (SCST_SLAB_FLAGS|SLAB_HWCACHE_ALIGN), NULL +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)) + , NULL); +#else + ); +#endif return; }