Open-CAS / open-cas-linux

Open CAS Linux
https://open-cas.com
BSD 3-Clause "New" or "Revised" License
216 stars 82 forks source link

Support Linux kernel 5.15.0-116-generic #1478

Closed ledz0 closed 1 month ago

ledz0 commented 1 month ago

Description

When we build Open-cas-linux on a new kernel 5.15.0-116-generic, we get an implicit declaration of the 'module_put_and_exit' function

Expected Behavior

Compiled package Open-cas-linux in Linux OS with new kernel 5.15.0-116-generic

Actual Behavior

Error when compiling a package.

Steps to Reproduce

Upgrade kernel to 5.15.0-116-generic and compile Open-cas-linux

apt upgrade
git clone https://github.com/Open-CAS/open-cas-linux
cd open-cas-linux
git submodule update --init
./configure
make

Logs

root@sw:~/open-cas-linux# make cd modules && make make[1]: Entering directory '/root/open-cas-linux/modules' make[2]: Entering directory '/root/open-cas-linux/ocf' make[3]: Entering directory '/root/open-cas-linux/ocf' make[3]: Nothing to be done for 'distcleandir'. make[3]: Leaving directory '/root/open-cas-linux/ocf' make[2]: Leaving directory '/root/open-cas-linux/ocf' make[2]: Entering directory '/root/open-cas-linux/ocf' make[3]: Entering directory '/root/open-cas-linux/ocf' make[3]: Nothing to be done for 'distcleandir'. make[3]: Leaving directory '/root/open-cas-linux/ocf' make[2]: Leaving directory '/root/open-cas-linux/ocf' cd "/lib/modules/"5.15.0-116-generic"/build" && make M=/root/open-cas-linux/modules modules make[2]: Entering directory '/usr/src/linux-headers-5.15.0-116-generic' CC [M] /root/open-cas-linux/modules/cas_cache/layer_cache_management.o /root/open-cas-linux/modules/cas_cache/layer_cache_management.c: In function ‘exit_instance_finish’: /root/open-cas-linux/modules/cas_cache/layer_cache_management.c:604:9: error: implicit declaration of function ‘module_put_and_exit’; did you mean ‘complete_and_exit’? [-Werror=implicit-function-declaration] 604 | module_put_and_exit(0); | ^~~~~~~ | complete_and_exit /root/open-cas-linux/modules/cas_cache/layer_cache_management.c:605:1: error: control reaches end of non-void function [-Werror=return-type] 605 | } | ^ cc1: all warnings being treated as errors make[4]: [scripts/Makefile.build:297: /root/open-cas-linux/modules/cas_cache/layer_cache_management.o] Error 1 make[3]: [scripts/Makefile.build:560: /root/open-cas-linux/modules/cas_cache] Error 2 make[2]: [Makefile:1911: /root/open-cas-linux/modules] Error 2 make[2]: Leaving directory '/usr/src/linux-headers-5.15.0-116-generic' make[1]: [Makefile:48: default] Error 2 make[1]: Leaving directory '/root/open-cas-linux/modules' make: *** [Makefile:22: modules] Error 2

Your Environment

robertbaldyga commented 1 month ago

Well, looks like Canonical decided to change module_put_and_exit() to module_put_and_kthread_exit() between minor kernel versions. A weird decision to break compatibility like that, but what's even weirder is that module_put_and_exit() actually disappeared from the kernel since version 5.10. So apparently Canonical were reverting this change on the newer kernels till this point (presumably to avoid porting some of their own drivers to newer API). Open CAS have both module_put_and_exit() and module_put_and_kthread_exit() supported on the current master, but this patch never ended up in the v22.6.x line. I suppose we need to backport it to maintain compatibility with Canonicals newer 5.15 kernel. 5 15 0-72_vs_5 15 0-116

robertbaldyga commented 1 month ago

@ledz0 The fix has been backported to v22.6.x line and I just published v22.6.3 bugfix release: https://github.com/Open-CAS/open-cas-linux/releases/tag/v22.6.3