Merge branch 'svn-trunk'

This commit is contained in:
Bart Van Assche
2020-05-09 15:57:06 -07:00
12 changed files with 277 additions and 90 deletions

View File

@@ -1,6 +1,6 @@
#!/bin/bash
source ../scripts/kernel-functions
source "$(dirname "$0")/../scripts/kernel-functions" || exit $?
#########################
# Argument verification #
@@ -15,7 +15,8 @@ fi
mkdir -p qla2xxx-orig
cd qla2xxx-orig || exit $?
download_and_extract_kernel_tree "${kernel_version}"
download_and_extract_kernel_tree "${kernel_version}" || exit $?
kernel_version=${kernel_version/^*}
touch "linux-${kernel_version}"/drivers/scsi/qla2xxx/*
rm -rf "${kernel_version}"
mkdir -p "${kernel_version}/include/trace/events"

View File

@@ -2,15 +2,17 @@
kernel_version="$1"
if [ "$1" = "" ]; then
if [ "$kernel_version" = "" ]; then
echo "Error: missing kernel version argument."
exit 1
fi
if [ ! -e qla2xxx-orig/$1 ]; then
./extract-qla2xxx-orig "$1"
if [ ! -e qla2xxx-orig/${kernel_version/^*} ]; then
"$(dirname "$0")/extract-qla2xxx-orig" "$kernel_version" || exit $?
fi
kernel_version=${kernel_version/^*}
mkdir -p in-tree-patches/"${kernel_version}"
for g in Kconfig *.[ch]; do

View File

@@ -1,6 +1,6 @@
#!/bin/bash
source ../scripts/kernel-functions
source "$(dirname "$0")/../scripts/kernel-functions" || exit $?
#########################
# Argument verification #
@@ -15,7 +15,8 @@ fi
mkdir -p qla2xxx-orig
cd qla2xxx-orig || exit $?
download_and_extract_kernel_tree "${kernel_version}"
download_and_extract_kernel_tree "${kernel_version}" || exit $?
kernel_version=${kernel_version/^*}
touch "linux-${kernel_version}"/drivers/scsi/qla2xxx/*
rm -rf "${kernel_version}"
mkdir -p "${kernel_version}"

View File

@@ -2,15 +2,17 @@
kernel_version="$1"
if [ "$1" = "" ]; then
if [ "$kernel_version" = "" ]; then
echo "Error: missing kernel version argument."
exit 1
fi
if [ ! -e qla2xxx-orig/$1 ]; then
./extract-qla2xxx-orig "$1"
if [ ! -e qla2xxx-orig/${kernel_version/^*} ]; then
"$(dirname "$0")/extract-qla2xxx-orig" "$kernel_version" || exit $?
fi
kernel_version=${kernel_version/^*}
mkdir -p in-tree-patches/"${kernel_version}"
for g in Kconfig *.[ch]; do

View File

@@ -105,6 +105,21 @@ EOF
# Run the script specialize_patch with appropriate options on the patch
# passed via stdin and send the specialized patch to stdout.
function specialize_patch {
local arr ao
readarray -d ^ -t arr <<<"$1^^^^"
local kver=${arr[0]}
local distro=${arr[1]}
local release=${arr[2]}
readarray -d . -t arr <<<"$release..."
local releasevermajor="${arr[0]}"
local releaseverminor="${arr[1]}"
if [ -n "$releasevermajor" ]; then
ao=(
-v RHEL_MAJOR=$releasevermajor
-v RHEL_MINOR=$releaseverminor
-v RHEL_RELEASE_CODE=$((releasevermajor * 256 + releaseverminor))
)
fi
if [ "${enable_specialize}" = "true" ]; then
if [ "${generating_upstream_patch}" = "true" ]; then
scripts/filter-trace-entry-exit
@@ -113,14 +128,14 @@ function specialize_patch {
fi |
"$(dirname "$0")/specialize-patch" \
"${specialize_patch_options[@]}" \
-v kernel_version="${kver3}" \
-v SCST_IO_CONTEXT="${scst_io_context}"
-v kernel_version="${kver/-*}" \
-v SCST_IO_CONTEXT="${scst_io_context}" "${ao[@]}"
else
cat
fi
}
# Read a patch from stdin, specialize it for kernel version ${kver}
# Read a patch from stdin, specialize it for kernel version ${full_kver}
# and write the output either to stdout or to the file $1 (if not empty),
# depending on the value of the variable ${multiple_patches}.
function process_patch {
@@ -132,7 +147,7 @@ function process_patch {
fi
tmppatch="$(/bin/mktemp)"
(
specialize_patch
specialize_patch "${full_kver}"
) >"${tmppatch}"
touch "${tmppatch}"
{
@@ -151,7 +166,7 @@ function process_patch {
true
fi
else
specialize_patch
specialize_patch "${full_kver}"
fi
}
@@ -208,6 +223,7 @@ if [ $# != 1 ]; then
fi
# Strip patch level from the kernel version number.
full_kver="$1"
kver="$(kernel_version "$1")"
# kver3: first three components of the version number.
if [ "${1#2.}" != "$1" ]; then
@@ -507,7 +523,7 @@ add_file "iscsi-scst/README_in-tree" "Documentation/scst/README.iscsi" \
if [ "${qla2x00t}" = "true" ]; then
( cd qla2x00t && ./generate-in-tree-patches "$1" )
( cd qla2x00t && "$PWD/generate-in-tree-patches" "$1" ) || exit $?
for f in qla2x00t/in-tree-patches/"$1"/*.patch; do
[ -e "$f" ] || continue
@@ -533,7 +549,7 @@ if [ "${qla2x00t}" = "true" ]; then
elif [ "${qla2x00t_32gbit}" = "true" ]; then
( cd qla2x00t-32gbit && ./generate-in-tree-patches "$1" )
( cd qla2x00t-32gbit && "$PWD/generate-in-tree-patches" "$1" ) || exit $?
for f in qla2x00t-32gbit/in-tree-patches/"$1"/*.patch; do
[ -e "$f" ] || continue

View File

@@ -2,6 +2,9 @@
# Shell functions for parsing the Linux kernel version and for downloading
# from kernel.org.
# shellcheck source=./rhel-rpm-functions
source "$(dirname "$0")/../scripts/rhel-rpm-functions" || return $?
kernel_mirror="http://cdn.kernel.org/pub/linux/kernel"
kernel_downloads="$HOME/software/downloads"
kernel_tree="$HOME/software/linux-kernel"
@@ -435,10 +438,37 @@ EOF
done
}
function download_and_extract_distro_rpm {
[ -n "$1" ] || return $?
local arr
readarray -d ^ -t arr <<<"$1^^^^"
local kver=${arr[0]}
local distro=${arr[1]}
local release=${arr[2]}
(
cd "${kernel_downloads}" || exit $?
urls=($(get_srpm_urls "$distro" "$release" x86_64))
for url in "${urls[@]}"; do
wget -q -nc "${url}/kernel-${kver}.src.rpm" && break
done
)
local tmpdir=kernel-tree-tmp-$$
rm -rf "linux-$1" "${tmpdir}"
mkdir "${tmpdir}" || return $?
(
cd "${tmpdir}" &&
rpm2cpio "${kernel_downloads}/kernel-${kver}.src.rpm" |
cpio -i --make-directories --quiet &&
tar xaf linux-${kver}.tar.* &&
mv "linux-${kver}" ".." &&
cd "../linux-${kver}"
) || return $?
rm -rf "${tmpdir}"
}
function download_and_extract_kernel_tree {
if [ -e "${kernel_tree}" ]; then
rm -rf "linux-$1"
mkdir "linux-$1"
{ [ "${1/^}" = "$1" ] &&
(
cd "${kernel_tree}" &&
{
@@ -450,12 +480,17 @@ function download_and_extract_kernel_tree {
git fetch stable
}
} &&
{ git tag -l "v$1" | grep -q '^v'; } &&
git archive "v$1"
) | tar -C "linux-$1" -xf-
) | {
rm -rf "linux-$1" &&
mkdir "linux-$1" &&
tar -C "linux-$1" -xf- 2>/dev/null
}; } || download_and_extract_distro_rpm "$1"
else
download_kernel "$1" && extract_kernel_tree "$1"
fi &&
(cd "linux-$1" && patch_kernel "$1")
(cd "linux-${1/^*}" && patch_kernel "${1/^*}")
}
# For shellcheck

112
scripts/rhel-rpm-functions Normal file
View File

@@ -0,0 +1,112 @@
# -*- mode: shell-script -*-
# Shell functions for downloading and extracting a RHEL or RHEL clone RPM
# Arguments:
# $1: Linux distribution name
# $2: Linux distribution version (major.minor)
# $3: architecture
function get_srpm_urls() {
local arch distro releasever releasevermajor releaseverminor
distro="$1"
releasever="$2"
arch="$3"
IFS=.
set -- "$2"
unset IFS
releasevermajor="$1"
releaseverminor="$2"
case "$distro" in
"CentOS"*)
case $releasever in
5.*|6.[01])
echo "http://vault.centos.org/${releasever}/os/SRPMS"
echo "http://vault.centos.org/${releasever}/updates/SRPMS";;
[67]*)
echo "http://vault.centos.org/${releasever}/os/Source/SPackages"
echo "http://vault.centos.org/${releasever}/updates/Source/SPackages";;
8*)
echo "http://vault.centos.org/${releasever}/BaseOS/Source/SPackages/";;
esac
;;
"Red Hat Enterprise Linux"*)
case $releasever in
[56].*)
echo "http://ftp.redhat.com/pub/redhat/linux/enterprise/${releasevermajor}Server/en/os/SRPMS"
echo "http://ftp.redhat.com/redhat/rhel/rc/7/Server/source/tree/Packages";;
esac
;;
"Oracle Linux Server")
echo "http://public-yum.oracle.com/repo/OracleLinux/OL${releasevermajor}/${releaseverminor}/base/${arch}/getPackageSource"
echo "http://public-yum.oracle.com/repo/OracleLinux/OL${releasevermajor}/latest/${arch}/getPackageSource"
echo "http://public-yum.oracle.com/repo/OracleLinux/OL${releasevermajor}/UEK/latest/${arch}/getPackageSource"
;;
"Scientific Linux")
case $releasever in
5.*)
echo "http://ftp.scientificlinux.org/linux/scientific/$releasevermajor$releaseverminor/SRPMS/vendor";;
6.*)
echo "http://ftp.scientificlinux.org/linux/scientific/$releasever/SRPMS/vendor";;
esac
;;
*)
echo "Unknown type of distribution: $distro" >&2
return 1
;;
esac
}
# Arguments:
# $1: Linux distribution name
# $2: Linux distribution version (major.minor)
# $3: architecture
function get_rpm_urls() {
local arch distro releasever releasevermajor releaseverminor
distro="$1"
releasever="$2"
arch="$3"
IFS=.
set -- "$2"
unset IFS
releasevermajor="$1"
releaseverminor="$2"
case "$distro" in
"CentOS"*)
case $releasever in
5.*)
echo "http://vault.centos.org/${releasever}/os/${arch}/CentOS http://vault.centos.org/${releasever}/updates/${arch}/RPMS";;
6.[01])
echo "http://vault.centos.org/${releasever}/os/${arch}/Packages"
echo "http://vault.centos.org/${releasever}/updates/${arch}/Packages";;
[67]*)
echo "https://mirrors.edge.kernel.org/centos/${releasever}/updates/${arch}/Packages"
echo "http://vault.centos.org/${releasever}/updates/${arch}/Packages"
echo "http://vault.centos.org/${releasever}/os/${arch}/Packages http://vault.centos.org/${releasever}/updates/${arch}/Packages";;
8*)
echo "https://mirrors.edge.kernel.org/centos/8-stream/BaseOS/${arch}/os/Packages";;
esac
;;
"Red Hat Enterprise Linux"*)
echo "";;
"Oracle Linux Server")
echo "http://public-yum.oracle.com/repo/OracleLinux/OL${releasevermajor}/${releaseverminor}/base/${arch}/getPackageSource"
echo "http://public-yum.oracle.com/repo/OracleLinux/OL${releasevermajor}/latest/${arch}/getPackageSource"
echo "http://public-yum.oracle.com/repo/OracleLinux/OL${releasevermajor}/UEK/latest/${arch}/getPackageSource"
;;
"Scientific Linux")
case $releasever in
5.*)
echo "http://ftp.scientificlinux.org/linux/scientific/$releasevermajor$releaseverminor/SRPMS/vendor";;
6.*)
echo "http://ftp.scientificlinux.org/linux/scientific/$releasever/SRPMS/vendor";;
esac
;;
*)
echo "Unknown distribution type: $distro" >&2
return 1
;;
esac
}

View File

@@ -4,7 +4,7 @@
#
# Script for running those SCST regression tests that can be run automatically.
#
# Copyright (C) 2008-2009 Bart Van Assche <bvanassche@acm.org>
# Copyright (C) 2008-2020 Bart Van Assche <bvanassche@acm.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -199,22 +199,23 @@ function compile_scst_patched {
}
# Generate a kernel patch from the SCST source tree for kernel version $1
# and with generate-kernel-patch options $2.
# and with generate-kernel-patch options $2. $1 may be a
# ${kver}^${distro}^${release} triplet.
function generate_kernel_patch {
local kver
local patchfile="${outputdir}/scst-$1-kernel.patch"
local patchfile_m="${outputdir}/scst-$1-kernel-matching-line-numbers.patch"
local patchfile="${outputdir}/scst-${1/^*}-kernel.patch"
local patchfile_m="${outputdir}/scst-${1/^*}-kernel-matching-line-numbers.patch"
local driver_options=""
kver="$(kernel_version "$1")"
kver="$(kernel_version "${1/^*}")"
driver_options=(-l)
[ "${mpt_scst}" = "true" ] && driver_options+=("-m")
"${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" "$2" "$1" > "${patchfile}"
"${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" $2 "$1" > "${patchfile}"
"${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" -n "$2" "$1" > "${patchfile_m}"
"${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" -n $2 "$1" > "${patchfile_m}"
"${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" -p "${outputdir}/${patchdir}" "$2" "$1"
"${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" -p "${outputdir}/${patchdir}" $2 "$1"
}
# Run checkpatch on the generated kernel patch. Assumes that there is a
@@ -267,6 +268,7 @@ CONFIG_BINARY_PRINTF \
CONFIG_BLK_DEV_IO_TRACE \
CONFIG_BRANCH_PROFILE_NONE \
CONFIG_CONTEXT_SWITCH_TRACER \
CONFIG_DEBUG_SECTION_MISMATCH \
CONFIG_DEBUG_STRICT_USER_COPY_CHECKS \
CONFIG_DYNAMIC_FTRACE \
CONFIG_EVENT_TRACE_TEST_SYSCALLS \
@@ -292,6 +294,7 @@ CONFIG_MMIOTRACE \
CONFIG_NET_DROP_MONITOR \
CONFIG_NOP_TRACER \
CONFIG_RETPOLINE \
CONFIG_RH_KABI_SIZE_ALIGN_CHECKS \
CONFIG_SCHED_TRACER \
CONFIG_SECURITY_SELINUX \
CONFIG_STACK_TRACER \
@@ -630,7 +633,7 @@ do
run_smatch="true"
ipv6="true"
global_multiple_patches="${multiple_patches}"
while [ "${kv%-?}" != "${kv}" ] || [ "${kv%-??}" != "${kv}" ]; do
while true; do
kv_without_opt="${kv%-?}"
if [ "${kv_without_opt}" = "${kv}" ]; then
kv_without_opt="${kv%-??}"
@@ -645,7 +648,7 @@ do
'-nm') run_smatch="false";;
'-u') generate_kernel_patch_options="-u";;
'-p') multiple_patches="true";;
*) echo "Error: unknown option ${kopt}."; exit 1;;
*) break;;
esac
kv="${kv_without_opt}"
done
@@ -656,6 +659,7 @@ do
(
cd "${outputdir}" &&
download_and_extract_kernel_tree "$k" &&
k="${k/^*}" &&
cd "linux-$k/include/linux" &&
if [ ! -e compiler-gcc6.h ]; then
for f in compiler-gcc5.h compiler-gcc4.h; do
@@ -667,6 +671,7 @@ do
fi
) ||
continue
k="${k/^*}"
if [ "${run_checkpatch}" = "true" ]; then
run_checkpatch "$k"
fi

View File

@@ -72,18 +72,23 @@ function evaluate(stmnt, pattern, arg, op, result) {
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0))", stmnt)
gsub("defined\\(USE_PRE_440_WR_STRUCTURE\\)",
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0))", stmnt)
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) \\&\\& " \
"RHEL_RELEASE_CODE -0 < 7 * 256 + 5)", stmnt)
gsub("defined\\(IB_CREATE_CQ_HAS_INIT_ATTR\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) || " \
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt)
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 5)", stmnt)
gsub("defined\\(CREATE_SEND_MAD_HAS_AH_ARG\\)",
"(LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16))", stmnt)
gsub("defined\\(CREATE_SEND_MAD_HAS_BASE_ARG\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) || " \
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt)
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 5)", stmnt)
gsub("defined\\(IB_CM_LISTEN_TAKES_FOURTH_ARG\\)",
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0))", stmnt)
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) \\&\\& " \
"RHEL_RELEASE_CODE -0 < 7 * 256 + 5)", stmnt)
gsub("defined\\(IB_CLIENT_REMOVE_TAKES_TWO_ARGS\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) || " \
@@ -91,47 +96,46 @@ function evaluate(stmnt, pattern, arg, op, result) {
gsub("defined\\(IB_QUERY_GID_HAS_ATTR_ARG\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) || " \
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt)
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 5)", stmnt)
gsub("RDMA_CREATE_ID_TAKES_NET_ARG",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) || " \
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt)
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 5)", stmnt)
gsub("defined\\(HAVE_DEV_ATTR_MAX_RECV_SGE\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))", stmnt)
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) || " \
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 7)", stmnt)
gsub("HAVE_DEV_ATTR_MAX_SEND_SGE",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) || " \
"RHEL_RELEASE_CODE -0 >= 8 * 256 + 0)", stmnt)
gsub("defined\\(HAVE_DEV_ATTR_MAX_RECV_SGE\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) || " \
"RHEL_RELEASE_CODE -0 >= 8 * 256 + 0)", stmnt)
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 7)", stmnt)
gsub("HAVE_RDMA_DESTROY_AH_WITH_FLAGS",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 21, 0))", stmnt)
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 21, 0) || " \
"RHEL_RELEASE_CODE -0 >= 8 * 256 + 1)", stmnt)
gsub("HAVE_RDMA_DESTROY_AH",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0))", stmnt)
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) || " \
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 5)", stmnt)
gsub("HAVE_RDMA_QUERY_GID",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))", stmnt)
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) || " \
"RHEL_RELEASE_CODE -0 >= 8 * 256 + 1)", stmnt)
gsub("HAVE_SRP_DATA_DESC_IMM",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 21, 0))", stmnt)
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 21, 0) || " \
"RHEL_RELEASE_CODE -0 >= 8 * 256 + 1)", stmnt)
gsub("HAVE_STRUCT_SRP_LOGIN_REQ_RDMA",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 16, 0))", stmnt)
gsub("defined\\(USE_PRE_440_WR_STRUCTURE\\)",
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0))", stmnt)
gsub("defined\\(HAVE_IB_EVENT_GID_CHANGE\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) || " \
"RHEL_RELEASE_CODE -0 >= 6 * 256 + 10)", stmnt)
gsub("defined\\(HAVE_IB_QUERY_DEVICE\\)",
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0))", stmnt)
"(LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) \\&\\& " \
"RHEL_RELEASE_CODE -0 < 7 * 256 + 5)", stmnt)
gsub("defined\\(MAD_HANDLER_TAKES_SEND_BUF\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) || " \
@@ -139,11 +143,11 @@ function evaluate(stmnt, pattern, arg, op, result) {
gsub("defined\\(HAVE_IB_SET_CPI_RESP_TIME\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) || " \
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt)
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 5)", stmnt)
gsub("defined\\(IB_PD_HAS_LOCAL_DMA_LKEY\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) || " \
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt)
"RHEL_RELEASE_CODE -0 >= 7 * 256 + 5)", stmnt)
gsub("defined\\(HAVE_IB_DMA_MAP_OPS\\)",
"(LINUX_VERSION_CODE >= KERNEL_VERSION(0, 0, 0))", stmnt)
@@ -267,6 +271,12 @@ function evaluate(stmnt, pattern, arg, op, result) {
sub(pattern, op[1] == 0, stmnt)
}
pattern = "\\([[:blank:]]*(-*[0-9]+)[[:blank:]]*\\)"
while (match(stmnt, pattern, op) != 0)
{
sub(pattern, op[1], stmnt)
}
pattern="(-*[0-9]+)[[:blank:]]*(\\*|/)[[:blank:]]*(-*[0-9]+)"
while (match(stmnt, pattern, op) != 0)
{
@@ -385,6 +395,7 @@ function handle_if(evaluated)
if ($0 ~ "LINUX_VERSION_CODE" \
|| $0 ~ "CONFIG_SCST_PROC" \
|| $0 ~ "CONFIG_SCST_STRICT_SERIALIZING" \
|| $0 ~ "CREATE_SEND_MAD_HAS_AH_ARG" \
|| $0 ~ "CREATE_SEND_MAD_HAS_BASE_ARG" \
|| $0 ~ "ENABLE_NPIV" \
|| $0 ~ "FC_VPORT_CREATE_DEFINED" \
@@ -595,10 +606,12 @@ function dump_lines() {
if (h[0] != "")
printf "@@ -%d,%d +%d,%d @@%s\n",h[1],h[2]-lines_less_deleted,h[3],h[4]-lines_less_added,h[5]
for (i = 0; i < lines; i++) {
gsub("BAD_WR_MODIFIER",
LINUX_VERSION_CODE < version_code("4.19.0") ? "" : "const", line[i])
gsub("CM_HANDLER_EVENT_MODIFIER",
LINUX_VERSION_CODE < version_code("4.19.0") ? "" : "const", line[i])
modifier = (LINUX_VERSION_CODE < version_code("4.19.0") &&
(RHEL_MAJOR == "" ||
RHEL_MAJOR * 256 + RHEL_MINOR < 7 * 256 + 8) ?
"" : "const");
gsub("BAD_WR_MODIFIER", modifier, line[i])
gsub("CM_HANDLER_EVENT_MODIFIER", modifier, line[i])
print line[i]
}
}

View File

@@ -4885,7 +4885,9 @@ static inline struct scatterlist *sg_next_inline(struct scatterlist *sg)
static inline void sg_clear(struct scatterlist *sg)
{
memset(sg, 0, sizeof(*sg));
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0) && defined(CONFIG_DEBUG_SG)
#if defined(CONFIG_DEBUG_SG) && \
LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0) && \
(!defined(RHEL_MAJOR) && RHEL_MAJOR -0 < 8)
sg->sg_magic = SG_MAGIC;
#endif
}

View File

@@ -8561,7 +8561,8 @@ static void scsi_end_async(struct request *req, blk_status_t error)
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
lockdep_assert_held(req->q->queue_lock);
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 21, 0)
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 21, 0) && \
(!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 8)
if (!req->q->mq_ops)
lockdep_assert_held(req->q->queue_lock);
#endif

View File

@@ -102,8 +102,8 @@ start_daemon() {
"$@" >/dev/null 2>&1 &
}
killproc() {
local exe="`basename "$1"`"
killall $exe
exe=$(basename "$1")
killall "$exe"
rm -f "/var/run/$exe.pid"
}
fi
@@ -111,7 +111,7 @@ fi
# Whether or not there is a "TARGET_DRIVER iscsi" section in scst.conf.
using_iscsi() {
for m in $SCST_MODULES; do
if [ $m = "iscsi_scst" ]; then
if [ "$m" = "iscsi_scst" ]; then
return 0
fi
done
@@ -127,12 +127,12 @@ parse_scst_conf() {
if [ ! -e $SCST_CFG ]; then
return 0
fi
local nonblanks="[^[:blank:]]\{1,\}"
local blanks="[[:blank:]]\{1,\}"
local optblanks="[[:blank:]]*"
SCST_MODULES="$SCST_MODULES `sed -n -e 's/^HANDLER'"$blanks"'\('"$nonblanks"'\)'"$blanks"'{'"$optblanks"'$/\1/p' \
-e 's/^\[HANDLER'"$blanks"'\('"$nonblanks"'\)\]$/\1/p' $SCST_CFG \
| while read h; do
nonblanks="[^[:blank:]]\{1,\}"
blanks="[[:blank:]]\{1,\}"
optblanks="[[:blank:]]*"
SCST_MODULES="$SCST_MODULES $(sed -n -e "s/^HANDLER$blanks\($nonblanks\)$blanks{$optblanks\$/\1/p" \
-e "s/^\[HANDLER$blanks\($nonblanks\)\]\$/\1/p" $SCST_CFG \
| while read -r h; do
case "$h" in
dev_cdrom) echo scst_cdrom;;
dev_changer) echo scst_changer;;
@@ -145,18 +145,18 @@ parse_scst_conf() {
vdisk*|vcdrom) echo scst_vdisk;;
*) echo "$h";;
esac
done | sort -u` \
`sed -n 's/^TARGET_DRIVER'"$blanks"'\('"$nonblanks"'\)'"$blanks"'{'"$optblanks"'$/\1/p' $SCST_CFG | while read d; do
done | sort -u) \
$(sed -n "s/^TARGET_DRIVER$blanks\($nonblanks\)$blanks{$optblanks\$/\1/p" $SCST_CFG | while read -r d; do
case "$d" in
iscsi) echo iscsi_scst;;
qla2x00t) echo qla2x00tgt;;
copy_manager) ;;
*) echo "$d";;
esac
done | sort -u` \
done | sort -u) \
$SCST_TARGET_MODULES"
if using_iscsi; then
case "`uname -m`" in
case "$(uname -m)" in
x86_64|i686)
SCST_OPT_MODULES="crc32c-intel $SCST_OPT_MODULES";;
esac
@@ -168,8 +168,6 @@ parse_scst_conf() {
# Keep trying to unload kernel module $1 for up to $2 seconds. Return true
# if and only if the kernel module was unloaded before the timeout expired.
unload_kmod() {
local i m t
m="$1"
t="$2"
i=0
@@ -185,7 +183,7 @@ unload_kmod() {
# Unload SCST. parse_scst_conf must already have been invoked.
unload_scst() {
for d in $SCST_DAEMONS; do
killproc $d
killproc "$d"
done
# isert_scst must be unloaded before iscsi_scst. Note that unloading
@@ -199,14 +197,14 @@ unload_scst() {
reverse_list="$m $reverse_list"
done
for m in $reverse_list; do
refcnt="`cat /sys/module/$m/refcnt 2>/dev/null`"
if [ ! -z "$refcnt" ] && [ "$refcnt" -gt 0 ]; then
refcnt=$(cat "/sys/module/$m/refcnt" 2>/dev/null)
if [ -n "$refcnt" ] && [ "$refcnt" -gt 0 ]; then
# Apparently it can happen that the iscsi_scst refcnt is only
# decremented a short time after killproc finished. If that
# occurs, sleep for a short time.
sleep 1
fi
unload_kmod $m 30 || return 1
unload_kmod "$m" 30 || return 1
done
# Loading qla2x00tgt causes qla2xxx_scst to be loaded but removing
# qla2x00tgt does not cause qla2xxx_scst to be unloaded. Hence unload it
@@ -216,7 +214,7 @@ unload_scst() {
reverse_list="$m $reverse_list"
done
for m in $reverse_list; do
rmmod $m >/dev/null 2>&1
rmmod "$m" >/dev/null 2>&1
done
# Clear the config in case unloading failed or SCST has been built into the
@@ -229,7 +227,7 @@ unload_scst() {
}
start_scst() {
if [ -e /sys/module/scst -a -e /sys/module/scst/refcnt ]; then
if [ -e /sys/module/scst ] && [ -e /sys/module/scst/refcnt ]; then
echo Already started
return 0
fi
@@ -237,13 +235,13 @@ start_scst() {
parse_scst_conf
for m in $SCST_OPT_MODULES; do
modprobe $m >/dev/null 2>&1
modprobe "$m" >/dev/null 2>&1
done
for m in $SCST_MODULES; do
if [ ! -e /sys/module/$m ]; then
if ! modprobe $m; then
echo modprobe $m failed.
if [ ! -e "/sys/module/$m" ]; then
if ! modprobe "$m"; then
echo "modprobe $m failed."
unload_scst
return 5
fi
@@ -253,9 +251,9 @@ start_scst() {
for d in $SCST_DAEMONS; do
options=""
if [ "$(basename "$d")" = "iscsi-scstd" ]; then
options="${ISCSID_OPTIONS}"
options=${ISCSID_OPTIONS}
fi
if ! start_daemon $d $options; then
if ! start_daemon "$d" $options; then
echo "Starting $d failed"
unload_scst
return 1
@@ -298,16 +296,15 @@ scst_status() {
parse_scst_conf
for m in $SCST_MODULES; do
if [ ! -e /sys/module/$m ]; then
if [ ! -e "/sys/module/$m" ]; then
echo "$m: not loaded"
return 3
fi
done
for d in $SCST_DAEMONS; do
daemon_name=`basename ${d}`
pgrep ${daemon_name} > /dev/null 2>&1
if [ $? -ne 0 ]; then
daemon_name=$(basename "${d}")
if ! pgrep "${daemon_name}" > /dev/null 2>&1; then
echo "${daemon_name}: not running"
return 3
fi