From 39735956c7c64763756edc496c94153a1bfe7b99 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 17 Jun 2020 01:33:18 +0000 Subject: [PATCH 1/2] nightly build: Add RHEL / CentOS 8.2 kernel git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9025 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- nightly/conf/nightly.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nightly/conf/nightly.conf b/nightly/conf/nightly.conf index db16d5652..555e40b0f 100644 --- a/nightly/conf/nightly.conf +++ b/nightly/conf/nightly.conf @@ -61,7 +61,8 @@ ABT_KERNELS=" \ 2.6.33.7-nc \ 2.6.32.27-nc \ 2.6.31.14-nc \ -4.18.0-193.10.el8^CentOS^8.1.1911-nc \ +4.18.0-193.6.3.el8_2^CentOS^8.2.2004-nc \ +4.18.0-147.8.1.el8_1^CentOS^8.1.1911-nc \ 4.18.0-80.11.2.el8_0^CentOS^8.0.1905-nc \ 3.10.0-1127.el7^CentOS^7.8.2003-nc \ 3.10.0-1062.18.1.el7^CentOS^7.7.1908-nc \ From f7b704ee996b1831186ec2434c8ac7176625e9a7 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 17 Jun 2020 01:35:53 +0000 Subject: [PATCH 2/2] scst, iscsi-scst: Port to RHEL / CentOS 8.2 Apparently the Linux kernel v4.20 iov_iter_kvec() function has been backported to RHEL / CentOS 8.2. This patch fixes the following kernel warning: WARNING: CPU: 26 PID: 21141 at lib/iov_iter.c:1083 iov_iter_kvec+0x25/0x30 Call Trace: fileio_exec_async+0x216/0x3a0 [scst_vdisk] fileio_exec_write+0x3b9/0x450 [scst_vdisk] vdev_do_job+0x34/0xc0 [scst_vdisk] scst_do_real_exec+0x54/0x100 [scst] scst_exec_check_blocking+0xbb/0x210 [scst] scst_process_active_cmd+0x64d/0x1550 [scst] scst_cmd_thread+0x170/0x5a0 [scst] kthread+0x112/0x130 ret_from_fork+0x35/0x40 See also https://github.com/bvanassche/scst/issues/26. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9026 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/iscsi.c | 15 +++------------ iscsi-scst/kernel/nthread.c | 5 +---- scst/include/backport.h | 26 ++++++++++++++++++++++++++ scst/src/dev_handlers/scst_vdisk.c | 4 ---- 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index f187bf88b..7209251d2 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -1505,11 +1505,8 @@ static void cmnd_prepare_get_rejected_immed_data(struct iscsi_cmnd *cmnd) e = min_t(u32, s, PAGE_SIZE); conn->read_iov[i].iov_len = e; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) iov_iter_kvec(&conn->read_msg.msg_iter, READ, conn->read_iov, i, size); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) - iov_iter_kvec(&conn->read_msg.msg_iter, READ | ITER_KVEC, - conn->read_iov, i, size); #else conn->read_msg.msg_iov = conn->read_iov; conn->read_msg.msg_iovlen = i; @@ -1659,12 +1656,9 @@ static int cmnd_prepare_recv_pdu(struct iscsi_conn *conn, } i++; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) iov_iter_kvec(&conn->read_msg.msg_iter, READ, conn->read_iov, i, read_size); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) - iov_iter_kvec(&conn->read_msg.msg_iter, READ | ITER_KVEC, - conn->read_iov, i, read_size); #else conn->read_msg.msg_iov = conn->read_iov; conn->read_msg.msg_iovlen = i; @@ -1855,12 +1849,9 @@ static int nop_out_start(struct iscsi_cmnd *cmnd) sBUG_ON(size != 0); } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) iov_iter_kvec(&conn->read_msg.msg_iter, READ, conn->read_iov, i, cmnd->pdu.datasize); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) - iov_iter_kvec(&conn->read_msg.msg_iter, READ | ITER_KVEC, - conn->read_iov, i, cmnd->pdu.datasize); #else conn->read_msg.msg_iov = conn->read_iov; conn->read_msg.msg_iovlen = i; diff --git a/iscsi-scst/kernel/nthread.c b/iscsi-scst/kernel/nthread.c index e36727230..fba58efb3 100644 --- a/iscsi-scst/kernel/nthread.c +++ b/iscsi-scst/kernel/nthread.c @@ -463,11 +463,8 @@ static inline void iscsi_conn_init_read(struct iscsi_conn *conn, { conn->read_iov[0].iov_base = data; conn->read_iov[0].iov_len = len; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) iov_iter_kvec(&conn->read_msg.msg_iter, READ, conn->read_iov, 1, len); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) - iov_iter_kvec(&conn->read_msg.msg_iter, READ | ITER_KVEC, - conn->read_iov, 1, len); #else conn->read_msg.msg_iov = conn->read_iov; conn->read_msg.msg_iovlen = 1; diff --git a/scst/include/backport.h b/scst/include/backport.h index 11d2b9f77..431855c18 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -1606,6 +1606,32 @@ typedef unsigned long uintptr_t; char *kvasprintf(gfp_t gfp, const char *fmt, va_list ap); #endif +/* */ + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) +/* See also commit abb78f875f3f ("new helper: iov_iter_kvec()") # v3.19. */ +static inline void +iov_iter_kvec_backport(struct iov_iter *i, unsigned int direction, + const struct kvec *kvec, unsigned long nr_segs, + size_t count) +{ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) || \ + (defined(RHEL_MAJOR) && \ + (RHEL_MAJOR -0 > 8 || (RHEL_MAJOR -0 == 8 && RHEL_MINOR -0 >= 2))) + /* + * For iov_iter_kvec() implementations that have a WARN_ON(direction & + * ~(READ | WRITE)) statement. See also commit aa563d7bca6e ("iov_iter: + * Separate type from direction and use accessor functions") # v4.20. + */ + iov_iter_kvec(i, direction, kvec, nr_segs, count); +#else + iov_iter_kvec(i, ITER_KVEC | direction, kvec, nr_segs, count); +#endif +} + +#define iov_iter_kvec iov_iter_kvec_backport +#endif + /* */ #if defined(RHEL_MAJOR) && RHEL_MAJOR -0 <= 5 diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 79a6eb4d9..ef7713b27 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -3261,11 +3261,7 @@ static enum compl_status_e fileio_exec_async(struct vdisk_cmd_params *p) WARN_ON_ONCE(sg_cnt != cmd->sg_cnt); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) iov_iter_kvec(&iter, dir, p->async.kvec, sg_cnt, total); -#else - iov_iter_kvec(&iter, ITER_KVEC | dir, p->async.kvec, sg_cnt, total); -#endif *iocb = (struct kiocb) { .ki_pos = p->loff, .ki_filp = fd,