From 1f1e3e9c6ace6da995421d08e05f524854d7dc42 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Tue, 26 May 2026 17:42:05 -0400 Subject: [PATCH] Use timer_container_of with fallback for from_timer El9.8 backported the upstream v6.15.* rename of from_timer to timer_container_of. Switch the two callers in fence.c and recov.c to the new style and add a simple kcompat define for older kernels. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 9 +++++++++ kmod/src/fence.c | 2 +- kmod/src/kernelcompat.h | 5 +++++ kmod/src/recov.c | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 81dc8a58..112b4c8b 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -496,3 +496,12 @@ endif ifneq (,$(shell grep 'struct posix_acl.*get_inode_acl' include/linux/fs.h)) ccflags-y += -DKC_GET_INODE_ACL endif + +# +# v6.15-13744-g41cb08555c41 +# +# from_timer renamed to timer_container_of. +# +ifneq (,$(shell grep 'define timer_container_of' include/linux/timer.h)) +ccflags-y += -DKC_TIMER_CONTAINER_OF +endif diff --git a/kmod/src/fence.c b/kmod/src/fence.c index 3669dc2d..c63f27b4 100644 --- a/kmod/src/fence.c +++ b/kmod/src/fence.c @@ -222,7 +222,7 @@ static struct attribute *fence_attrs[] = { static void fence_timeout(struct timer_list *timer) { - struct pending_fence *fence = from_timer(fence, timer, timer); + struct pending_fence *fence = timer_container_of(fence, timer, timer); struct super_block *sb = fence->sb; DECLARE_FENCE_INFO(sb, fi); diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index 5564a12a..06855bf6 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -489,4 +489,9 @@ static inline void stack_trace_print(unsigned long *entries, unsigned int nr_ent } #endif +#ifndef KC_TIMER_CONTAINER_OF +#define timer_container_of(var, callback_timer, timer_fieldname) \ + from_timer(var, callback_timer, timer_fieldname) +#endif + #endif diff --git a/kmod/src/recov.c b/kmod/src/recov.c index d77e39cf..25855069 100644 --- a/kmod/src/recov.c +++ b/kmod/src/recov.c @@ -134,7 +134,7 @@ static int recov_finished(struct recov_info *recinf) static void timer_callback(struct timer_list *timer) { - struct recov_info *recinf = from_timer(recinf, timer, timer); + struct recov_info *recinf = timer_container_of(recinf, timer, timer); recinf->timeout_fn(recinf->sb); }