diff --git a/configure.d/1_module_put_and_exit.conf b/configure.d/1_module_put_and_exit.conf new file mode 100644 index 000000000..ddd8a77b6 --- /dev/null +++ b/configure.d/1_module_put_and_exit.conf @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Copyright(c) 2012-2022 Intel Corporation +# SPDX-License-Identifier: BSD-3-Clause +# + +. $(dirname $3)/conf_framework + + +check() { + cur_name=$(basename $2) + config_file_path=$1 + if compile_module $cur_name "module_put_and_kthread_exit(0);" "linux/module.h" + then + echo $cur_name 1 >> $config_file_path + else + echo $cur_name 2 >> $config_file_path + fi +} + +apply() { + case "$1" in + "1") + add_define "CAS_MODULE_PUT_AND_EXIT(code) module_put_and_kthread_exit(code)" ;; + "2") + add_define "CAS_MODULE_PUT_AND_EXIT(code) module_put_and_exit(code)" ;; + *) + exit 1 + esac +} + +conf_run $@ diff --git a/modules/cas_cache/layer_cache_management.c b/modules/cas_cache/layer_cache_management.c index 5c07b81ad..af5a81d5d 100644 --- a/modules/cas_cache/layer_cache_management.c +++ b/modules/cas_cache/layer_cache_management.c @@ -601,7 +601,7 @@ static int exit_instance_finish(void *data) if (result == -KCAS_ERR_WAITING_INTERRUPTED) kfree(ctx); - module_put_and_exit(0); + CAS_MODULE_PUT_AND_EXIT(0); } struct _cache_mngt_attach_context { @@ -649,7 +649,7 @@ static int cache_start_rollback(void *data) if (result == -KCAS_ERR_WAITING_INTERRUPTED) kfree(ctx); - module_put_and_exit(0); + CAS_MODULE_PUT_AND_EXIT(0); return 0; }