From 10e57d6cef2dce48fc1e1e6c716268e5dbc94cd5 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 21 Oct 2021 03:50:29 +0000 Subject: [PATCH] scst: Port to Ubuntu kernel 5.13.x (Ubuntu 21.10) Reported-by: Grant Albitz git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9584 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scripts/specialize-patch | 8 +++++++- scst/include/backport.h | 10 +++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/specialize-patch b/scripts/specialize-patch index b10dd5967..f08b00e33 100755 --- a/scripts/specialize-patch +++ b/scripts/specialize-patch @@ -68,6 +68,11 @@ function evaluate(stmnt, pattern, arg, op, result) { stmnt = "+#if !defined(" arg[1] ")" } + # See also commit c9c9762d4d44 ("block: return the correct bvec when checking + # for gaps"; v5.14-rc1). + gsub("defined\\(bio_multiple_segments\\)", + "(LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0))", stmnt) + gsub("defined\\(REGISTER_MAD_AGENT_HAS_FLAGS_ARG\\)", "(LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) || " \ "RHEL_RELEASE_CODE -0 >= 6 * 256 + 9)", stmnt) @@ -449,8 +454,9 @@ function handle_if(evaluated) || $0 ~ "RHEL_RELEASE_CODE" \ || $0 ~ "SOCK_RECVMSG_HAS_FOUR_ARGS" \ || $0 ~ "UEK_KABI_RENAME" \ - || $0 ~ "_COMPAT_LINUX_MM_H" \ || $0 ~ "USE_PRE_440_WR_STRUCTURE" \ + || $0 ~ "_COMPAT_LINUX_MM_H" \ + || $0 ~ "bio_multiple_segments" \ || generating_upstream_patch_defined \ && $0 ~ "GENERATING_UPSTREAM_PATCH" \ || $0 ~ "CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION" \ diff --git a/scst/include/backport.h b/scst/include/backport.h index 935de8ede..ea69927d2 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -2203,7 +2203,15 @@ static inline void *scsi_cmd_priv(struct scsi_cmnd *cmd) } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0) +/* + * The Debian 5.13.0 kernel has a scsi_build_sense() definition but does not + * define bio_multiple_segments() while the upstream 5.13.0 kernel defines + * bio_multiple_segments(). Hence the check two lines below for the Debian + * kernel. + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0) && \ + (LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(5, 13, 0) >> 8 || \ + defined(bio_multiple_segments)) /* * See also commit f2b1e9c6f867 ("scsi: core: Introduce scsi_build_sense()"; * v5.14-rc1).