diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index d213c691a..911796c3a 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -4212,8 +4212,8 @@ static int __init init_scst_user(void) goto out; } - user_cmd_cachep = KMEM_CACHE(scst_user_cmd, - SCST_SLAB_FLAGS|SLAB_HWCACHE_ALIGN); + user_cmd_cachep = KMEM_CACHE_USERCOPY(scst_user_cmd, + SCST_SLAB_FLAGS | SLAB_HWCACHE_ALIGN, user_cmd); if (user_cmd_cachep == NULL) { res = -ENOMEM; goto out_dev_cache; diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 8d3183a65..7660e288a 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -2586,6 +2586,13 @@ static int __init init_scst(void) sizeof(struct s)); \ (p); \ }) +#define INIT_CACHEP_ALIGN_USERCOPY(p, s, f) ({ \ + (p) = KMEM_CACHE_USERCOPY(s, SCST_SLAB_FLAGS | \ + SLAB_HWCACHE_ALIGN, f); \ + 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)) @@ -2601,7 +2608,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(scst_cmd_cachep, scst_cmd)) + if (!INIT_CACHEP_ALIGN_USERCOPY(scst_cmd_cachep, scst_cmd, cdb)) goto out_destroy_aen_cache; /* Big enough with read-mostly head and tail */ if (!INIT_CACHEP(scst_sess_cachep, scst_session))