mirror of
https://github.com/SCST-project/scst.git
synced 2026-10-22 14:12:33 +00:00
scst/include/backport.h: Fix timer compatibility on older kernels
The QLogic EDIF teardown now uses timer_shutdown(). Use the native helper
on Linux 6.2+, stable 6.1.158+ and 5.15.200+, RHEL 8.9+/9.3+, and the
Ubuntu kernels that backported it. Keep this compatibility change separate
from the import of upstream 292a089d78d3.
Also account for the timer_delete_sync() backport in Ubuntu 5.15.0-93.
Its headers report Linux 5.15.136, below the upstream stable 5.15.154
boundary, so the existing fallback redeclares a native kernel function.
The earlier Ubuntu fix covered timer_delete() but omitted its sync peer.
Limit the ABI check to the generic/HWE numbering range; flavour ABIs use
independent sequences.
Ubuntu 5.4.0-206 reports Linux 5.4.286 and is already covered by the
existing 5.4.274 stable boundary for timer_delete_sync().
On kernels without shutdown support, retain the previous timer_delete()
behavior. This fallback does not prevent rearming; that guarantee requires
support in the kernel timer implementation. Callers on these kernels still
have to exclude concurrent rearming themselves.
Fixes: d21b6f1457 ("scst: Port to Linux kernel v6.15")
This commit is contained in:
+35
-1
@@ -2071,7 +2071,11 @@ struct t10_pi_tuple {
|
||||
RHEL_MAJOR -0 == 8 && RHEL_MINOR -0 < 9 || \
|
||||
RHEL_MAJOR -0 == 9 && RHEL_MINOR -0 < 3) && \
|
||||
(!defined(UEK_KABI_RENAME) || \
|
||||
LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 17))
|
||||
LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 17)) && \
|
||||
(!defined(UTS_UBUNTU_RELEASE_ABI) || \
|
||||
LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(5, 15, 0) >> 8 || \
|
||||
UTS_UBUNTU_RELEASE_ABI - 0 < 93 || \
|
||||
UTS_UBUNTU_RELEASE_ABI - 0 >= 999)
|
||||
/*
|
||||
* See also commit 9b13df3fb64e ("timers: Rename del_timer_sync() to
|
||||
* timer_delete_sync()") # v6.2.
|
||||
@@ -2080,6 +2084,8 @@ struct t10_pi_tuple {
|
||||
* See also commit d8166e8adb7f # v5.10.215.
|
||||
* See also commit 2382f2e45c71 # v5.15.154.
|
||||
* See also commit 113d5341ee12 # v6.1.84.
|
||||
* See also Ubuntu commit 89cc650e4da5 # Ubuntu-5.15.0-93.103.
|
||||
* Ubuntu flavour ABIs >= 999 use independent version sequences.
|
||||
*/
|
||||
static inline int timer_delete_sync(struct timer_list *timer)
|
||||
{
|
||||
@@ -2111,6 +2117,34 @@ static inline int timer_delete(struct timer_list *timer)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0) && \
|
||||
(LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(6, 1, 0) >> 8 || \
|
||||
LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 158)) && \
|
||||
(LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(5, 15, 0) >> 8 || \
|
||||
LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 200)) && \
|
||||
(!defined(RHEL_MAJOR) || RHEL_MAJOR - 0 < 8 || \
|
||||
RHEL_MAJOR - 0 == 8 && RHEL_MINOR - 0 < 9 || \
|
||||
RHEL_MAJOR - 0 == 9 && RHEL_MINOR - 0 < 3) && \
|
||||
(!defined(UTS_UBUNTU_RELEASE_ABI) || \
|
||||
((LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(5, 15, 0) >> 8 || \
|
||||
UTS_UBUNTU_RELEASE_ABI - 0 < 93) && \
|
||||
(LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(5, 4, 0) >> 8 || \
|
||||
UTS_UBUNTU_RELEASE_ABI - 0 < 206)))
|
||||
/*
|
||||
* See also commit f571faf6e443 ("timers: Provide timer_shutdown[_sync]()") # v6.2.
|
||||
* See also commit 59b82a2e0c16 # v6.1.158.
|
||||
* See also commit 36bdfa51a1ad # v5.15.200.
|
||||
* Also backported to RHEL 8.9 / 9.3 and Ubuntu 5.15.0-93 / 5.4.0-206.
|
||||
*
|
||||
* Old kernels cannot prevent rearming through this API. Preserve the previous
|
||||
* timer deletion behavior; callers must exclude concurrent rearming themselves.
|
||||
*/
|
||||
static inline int timer_shutdown(struct timer_list *timer)
|
||||
{
|
||||
return timer_delete(timer);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* See also commit 686fef928bba ("timer: Prepare to change timer callback
|
||||
* argument type") # v4.14. See also commit 0eeda71bc30d ("timer: Replace
|
||||
|
||||
Reference in New Issue
Block a user