Merge pull request #1306 from kmajzero/RHEL8.5_4.18_support
RHEL8.5 kernel 4.18 support fix
This commit is contained in:
commit
13984c976a
68
configure.d/1_blk_queue_exit_for_rhel.conf
Normal file
68
configure.d/1_blk_queue_exit_for_rhel.conf
Normal file
@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2022 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
. $(dirname $3)/conf_framework
|
||||
|
||||
# RHEL8.5 kernel 4.18 subversion targeted for the workaround is 348.2.1.
|
||||
# The workaround is needed starting this version and up.
|
||||
LINUX_MAJOR_SINCE=4
|
||||
LINUX_MINOR_SINCE=18
|
||||
LINUX_SUB_SINCE=0
|
||||
RHEL_MAJOR_SINCE=348
|
||||
RHEL_MINOR_SINCE=2
|
||||
RHEL_SUB_SINCE=1
|
||||
|
||||
check () {
|
||||
cur_name=$(basename $2)
|
||||
config_file_path=$1
|
||||
LINUX_VERSION_CODE=$(get_define $cur_name "LINUX_VERSION_CODE" "generated/uapi/linux/version.h")
|
||||
RHEL_RELEASE=$(get_define $cur_name "RHEL_RELEASE" "generated/uapi/linux/version.h")
|
||||
LINUX_MAJOR=$((LINUX_VERSION_CODE >> 16 & 0xff))
|
||||
LINUX_MINOR=$((LINUX_VERSION_CODE >> 8 & 0xff))
|
||||
LINUX_SUB=$((LINUX_VERSION_CODE & 0xff))
|
||||
|
||||
if [ -z $RHEL_RELEASE ]; then
|
||||
echo $cur_name "2" >> $config_file_path; #not RHEL, no workaround needed
|
||||
else
|
||||
#it's RHEL, check versions to see if the workaround is needed
|
||||
|
||||
IFS=. read -a arr <<< $RHEL_RELEASE
|
||||
RHEL_MAJOR=${arr[0]}
|
||||
RHEL_MINOR=${arr[1]}
|
||||
RHEL_SUB=${arr[2]}
|
||||
|
||||
#check kernel and rhel version (major/minor/sub)
|
||||
if [ "$LINUX_MAJOR" -eq "$LINUX_MAJOR_SINCE" ] &&
|
||||
[ "$LINUX_MINOR" -eq "$LINUX_MINOR_SINCE" ] &&
|
||||
[ "$LINUX_SUB" -eq "$LINUX_SUB_SINCE" ] &&
|
||||
[ "$RHEL_MAJOR" -ge "$RHEL_MAJOR_SINCE" ] &&
|
||||
[ "$RHEL_MINOR" -ge "$RHEL_MINOR_SINCE" ] &&
|
||||
[ "$RHEL_SUB" -ge "$RHEL_SUB_SINCE" ]
|
||||
then
|
||||
echo $cur_name "1" >> $config_file_path; #workaround needed
|
||||
else
|
||||
echo $cur_name "2" >> $config_file_path; #no workaround needed
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
apply() {
|
||||
case "$1" in
|
||||
"1")
|
||||
add_define "cas_blk_queue_exit(bvol) \
|
||||
percpu_ref_put(&(casdisk_functions.casdsk_exp_obj_get_queue(bvol->dsk)->q_usage_counter) );
|
||||
"
|
||||
;;
|
||||
"2")
|
||||
add_define "cas_blk_queue_exit(bvol) (void)bvol;"
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
esac
|
||||
}
|
||||
|
||||
conf_run $@
|
@ -97,7 +97,7 @@ EOM
|
||||
|
||||
rm -Rf $test_module_dir
|
||||
|
||||
grep -Pom 1 "note:.*$define_name .*" $test_module_log | cut -d' ' -f 5- | tr -d '"'
|
||||
grep -Pom 1 "note:.*$define_name .*" $test_module_log | sed 's/[^0-9.]*//g'
|
||||
local ret=$?
|
||||
|
||||
rm -f $test_module_log
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright(c) 2012-2021 Intel Corporation
|
||||
* Copyright(c) 2012-2022 Intel Corporation
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
@ -19,6 +19,11 @@ struct bio_vec_iter {
|
||||
};
|
||||
|
||||
struct blk_data {
|
||||
/**
|
||||
* @brief bd_object for accessing request queue. Workaround for RHEL8.5
|
||||
*/
|
||||
struct bd_object *bvol;
|
||||
|
||||
/**
|
||||
* @brief Atomic counter for core device
|
||||
*/
|
||||
|
@ -182,6 +182,7 @@ static void blkdev_defer_bio(struct bd_object *bvol, struct bio *bio,
|
||||
if (!context) {
|
||||
CAS_BIO_ENDIO(bio, CAS_BIO_BISIZE(bio),
|
||||
CAS_ERRNO_TO_BLK_STS(-ENOMEM));
|
||||
cas_blk_queue_exit(bvol);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -206,6 +207,8 @@ static void blkdev_complete_data_master(struct blk_data *master, int error)
|
||||
result = map_cas_err_to_generic(master->error);
|
||||
CAS_BIO_ENDIO(master->bio, master->master_size,
|
||||
CAS_ERRNO_TO_BLK_STS(result));
|
||||
cas_blk_queue_exit(master->bvol);
|
||||
|
||||
cas_free_blk_data(master);
|
||||
}
|
||||
|
||||
@ -274,6 +277,7 @@ static int blkdev_handle_data_single(struct bd_object *bvol, struct bio *bio,
|
||||
data->bio = master_ctx->bio;
|
||||
data->master_size = master_ctx->master_size;
|
||||
data->start_time = master_ctx->start_time;
|
||||
data->bvol = bvol;
|
||||
master_ctx->data = data;
|
||||
}
|
||||
|
||||
@ -304,6 +308,7 @@ static void blkdev_handle_data(struct bd_object *bvol, struct bio *bio)
|
||||
CAS_BIO_OP_FLAGS_FORMAT "\n", CAS_BIO_OP_FLAGS(bio));
|
||||
CAS_BIO_ENDIO(bio, CAS_BIO_BISIZE(bio),
|
||||
CAS_ERRNO_TO_BLK_STS(-EINVAL));
|
||||
cas_blk_queue_exit(bvol);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -329,20 +334,26 @@ static void blkdev_handle_data(struct bd_object *bvol, struct bio *bio)
|
||||
return;
|
||||
|
||||
err:
|
||||
if (split != bio)
|
||||
if (split != bio) {
|
||||
bio_put(split);
|
||||
if (master_ctx.data)
|
||||
}
|
||||
if (master_ctx.data) {
|
||||
blkdev_complete_data_master(master_ctx.data, error);
|
||||
else
|
||||
}
|
||||
else {
|
||||
CAS_BIO_ENDIO(bio, CAS_BIO_BISIZE(bio), CAS_ERRNO_TO_BLK_STS(error));
|
||||
cas_blk_queue_exit(bvol);
|
||||
}
|
||||
}
|
||||
|
||||
static void blkdev_complete_discard(struct ocf_io *io, int error)
|
||||
{
|
||||
struct bio *bio = io->priv1;
|
||||
struct bd_object *bvol = io->priv2;
|
||||
int result = map_cas_err_to_generic(error);
|
||||
|
||||
CAS_BIO_ENDIO(bio, CAS_BIO_BISIZE(bio), CAS_ERRNO_TO_BLK_STS(result));
|
||||
cas_blk_queue_exit(bvol);
|
||||
ocf_io_put(io);
|
||||
}
|
||||
|
||||
@ -360,10 +371,11 @@ static void blkdev_handle_discard(struct bd_object *bvol, struct bio *bio)
|
||||
CAS_PRINT_RL(KERN_CRIT
|
||||
"Out of memory. Ending IO processing.\n");
|
||||
CAS_BIO_ENDIO(bio, CAS_BIO_BISIZE(bio), CAS_ERRNO_TO_BLK_STS(-ENOMEM));
|
||||
cas_blk_queue_exit(bvol);
|
||||
return;
|
||||
}
|
||||
|
||||
ocf_io_set_cmpl(io, bio, NULL, blkdev_complete_discard);
|
||||
ocf_io_set_cmpl(io, bio, bvol, blkdev_complete_discard);
|
||||
|
||||
ocf_volume_submit_discard(io);
|
||||
}
|
||||
@ -387,6 +399,7 @@ static void blkdev_complete_flush(struct ocf_io *io, int error)
|
||||
if (CAS_BIO_BISIZE(bio) == 0 || error) {
|
||||
CAS_BIO_ENDIO(bio, CAS_BIO_BISIZE(bio),
|
||||
CAS_ERRNO_TO_BLK_STS(result));
|
||||
cas_blk_queue_exit(bvol);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -409,6 +422,7 @@ static void blkdev_handle_flush(struct bd_object *bvol, struct bio *bio)
|
||||
CAS_PRINT_RL(KERN_CRIT
|
||||
"Out of memory. Ending IO processing.\n");
|
||||
CAS_BIO_ENDIO(bio, CAS_BIO_BISIZE(bio), CAS_ERRNO_TO_BLK_STS(-ENOMEM));
|
||||
cas_blk_queue_exit(bvol);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -430,6 +444,7 @@ static void blkdev_submit_bio(struct bd_object *bvol, struct bio *bio)
|
||||
if (blkdev_can_hndl_bio(bio)) {
|
||||
CAS_BIO_ENDIO(bio, CAS_BIO_BISIZE(bio),
|
||||
CAS_ERRNO_TO_BLK_STS(-ENOTSUPP));
|
||||
cas_blk_queue_exit(bvol);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user