From 1e1eeccc6b639adaae611e5783bad60eeafae92a Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 10 Jul 2018 04:09:05 +0000 Subject: [PATCH 1/7] scst_lib: Document scst_scsi_execute() arguments git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7404 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_lib.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index f38b8377d..a46836113 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -6862,6 +6862,21 @@ out: return res; } +/** + * scsi_execute - insert a SCSI request and wait for the result + * @sdev: scsi device + * @cmd: scsi command + * @data_direction: data direction + * @buffer: data buffer + * @bufflen: length of buffer - DMA_TO_DEVICE, DMA_FROM_DEVICE or DMA_NONE + * @sense: optional sense buffer + * @timeout: request timeout in seconds + * @retries: number of times to retry request + * @flags: flags for ->cmd_flags, e.g. REQ_FAILFAST_DEV + * + * Returns the scsi_cmnd result field if a command was executed, or a negative + * Linux error code if we didn't get that far. + */ int scst_scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned int bufflen, unsigned char *sense, int timeout, int retries, u64 flags) From 337e23f3f30f1cb0f0b824dd062d47def0c72b0d Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 10 Jul 2018 04:09:39 +0000 Subject: [PATCH 2/7] nightly build: Update kernel versions git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7405 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- nightly/conf/nightly.conf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nightly/conf/nightly.conf b/nightly/conf/nightly.conf index b015a4222..9c3061cd0 100644 --- a/nightly/conf/nightly.conf +++ b/nightly/conf/nightly.conf @@ -3,21 +3,21 @@ ABT_DETAILS="x86_64" ABT_JOBS=5 ABT_KERNELS=" \ -4.15.7 \ -4.14.24-nc \ -4.13.12-nc \ +4.15.18 \ +4.14.52-nc \ +4.13.16-nc \ 4.12.14-nc \ 4.11.12-nc \ 4.10.17-nc \ -4.9.86-nc \ +4.9.110-nc \ 4.8.17-nc \ 4.7.10-nc \ 4.6.7-nc \ 4.5.7-nc \ -4.4.120-nc \ +4.4.138-nc \ 4.3.6-nc \ 4.2.8-nc \ -4.1.38-nc \ +4.1.52-nc \ 4.0.9-nc \ 3.19.8-nc \ 3.18.98-nc \ From 841cc5812a7ada9d72d3e2dc140ba2057a3663c9 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 10 Jul 2018 04:10:09 +0000 Subject: [PATCH 3/7] nightly build, scripts/kernel-functions: Backport v4.16 gcc-8 fixes to kernel v4.15 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7406 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scripts/kernel-functions | 90 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/scripts/kernel-functions b/scripts/kernel-functions index d9ad40f4d..6e5605c04 100644 --- a/scripts/kernel-functions +++ b/scripts/kernel-functions @@ -225,6 +225,96 @@ index 3f2793d..96e45ea 100644 EOF fi fi + if [ "${1#4.15}" != "$1" ]; then + patch -f -s -p1 <<'EOF' +From ad343a98e74e85aa91d844310e797f96fee6983b Mon Sep 17 00:00:00 2001 +From: Sergey Senozhatsky +Date: Tue, 6 Feb 2018 15:37:52 -0800 +Subject: [PATCH] tools/lib/subcmd/pager.c: do not alias select() params + +Use a separate fd set for select()-s exception fds param to fix the +following gcc warning: + + pager.c:36:12: error: passing argument 2 to restrict-qualified parameter aliases with argument 4 [-Werror=restrict] + select(1, &in, NULL, &in, NULL); + ^~~ ~~~ + +Link: http://lkml.kernel.org/r/20180101105626.7168-1-sergey.senozhatsky@gmail.com +Signed-off-by: Sergey Senozhatsky +Cc: Arnaldo Carvalho de Melo +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +--- + tools/lib/subcmd/pager.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/tools/lib/subcmd/pager.c b/tools/lib/subcmd/pager.c +index 5ba754d17952..9997a8805a82 100644 +--- a/tools/lib/subcmd/pager.c ++++ b/tools/lib/subcmd/pager.c +@@ -30,10 +30,13 @@ static void pager_preexec(void) + * have real input + */ + fd_set in; ++ fd_set exception; + + FD_ZERO(&in); ++ FD_ZERO(&exception); + FD_SET(0, &in); +- select(1, &in, NULL, &in, NULL); ++ FD_SET(0, &exception); ++ select(1, &in, NULL, &exception, NULL); + + setenv("LESS", "FRSX", 0); + } +EOF + patch -f -s -p1 <<'EOF' +From 854e55ad289ef8888e7991f0ada85d5846f5afb9 Mon Sep 17 00:00:00 2001 +From: Josh Poimboeuf +Date: Thu, 15 Mar 2018 22:11:54 -0500 +Subject: [PATCH] objtool, perf: Fix GCC 8 -Wrestrict error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Starting with recent GCC 8 builds, objtool and perf fail to build with +the following error: + + ../str_error_r.c: In function 'str_error_r': + ../str_error_r.c:25:3: error: passing argument 1 to restrict-qualified parameter aliases with argument 5 [-Werror=restrict] + snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err); + +The code seems harmless, but there's probably no benefit in printing the +'buf' pointer in this situation anyway, so just remove it to make GCC +happy. + +Reported-by: Laura Abbott +Signed-off-by: Josh Poimboeuf +Tested-by: Laura Abbott +Cc: Adrian Hunter +Cc: Jiri Olsa +Cc: Namhyung Kim +Cc: Wang Nan +Link: http://lkml.kernel.org/r/20180316031154.juk2uncs7baffctp@treble +Signed-off-by: Arnaldo Carvalho de Melo +--- + tools/lib/str_error_r.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/lib/str_error_r.c b/tools/lib/str_error_r.c +index d6d65537b0d9..6aad8308a0ac 100644 +--- a/tools/lib/str_error_r.c ++++ b/tools/lib/str_error_r.c +@@ -22,6 +22,6 @@ char *str_error_r(int errnum, char *buf, size_t buflen) + { + int err = strerror_r(errnum, buf, buflen); + if (err) +- snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err); ++ snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, [buf], %zd)=%d", errnum, buflen, err); + return buf; + } +EOF + fi # After patch-v4.14.1[12] has been applied, the execute bit has to be # set for sync-check.sh since patch can't do that. for f in "tools/objtool/sync-check.sh"; do From f1acec0e570c64b9e875da68110131ff702ef558 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 10 Jul 2018 04:12:34 +0000 Subject: [PATCH 4/7] ib_srpt/Makefile: Fix OFED/MOFED detection on RHEL 7.4 Because of a not fully root-caused reason (make bug?) the output of the shell commands used to determine the (M)OFED RPM name was written to stderr instead of stdout. Work around this bug by splitting the shell commands used to determine the (M)OFED RPM names. Reported-by: Sergey Gorenko git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7407 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/srpt/Makefile b/srpt/Makefile index bd7ead229..35da325f5 100644 --- a/srpt/Makefile +++ b/srpt/Makefile @@ -54,10 +54,14 @@ MODULE_SYMVERS:=$(shell if [ -e "$(KDIR)/Module.symvers" ]; then \ echo Module.symvers; else echo Modules.symvers; fi) # Name of the OFED kernel package. -OFED_KERNEL_IB_PKG:=$(shell for r in mlnx-ofa_kernel compat-rdma kernel-ib; do rpm -q $$r 2>/dev/null | grep -q "^$$r" && echo "$$r" && break; done; for p in mlnx-ofed-kernel-dkms; do dpkg-query -s "$$p" >/dev/null 2>&1 && echo "$$p" && break; done) +OFED_KERNEL_IB_RPM:=$(shell for r in mlnx-ofa_kernel compat-rdma kernel-ib; do rpm -q $$r 2>/dev/null | grep -q "^$$r" && echo "$$r" && break; done) +OFED_KERNEL_IB_DEB:=$(shell for p in mlnx-ofed-kernel-dkms; do dpkg-query -s "$$p" >/dev/null 2>&1 && echo "$$p" && break; done) +OFED_KERNEL_IB_PKG:=$(OFED_KERNEL_IB_RPM)$(OFED_KERNEL_IB_DEB) # Name of the OFED kernel development package. -OFED_KERNEL_IB_DEVEL_PKG:=$(shell for r in mlnx-ofa_kernel-devel compat-rdma-devel kernel-ib-devel; do rpm -q $$r 2>/dev/null | grep -q "^$$r" && echo "$$r" && break; done; for p in mlnx-ofed-kernel-dkms; do dpkg-query -s "$$p" >/dev/null 2>&1 && echo "$$p" && break; done) +OFED_KERNEL_IB_DEVEL_RPM:=$(shell for r in mlnx-ofa_kernel-devel compat-rdma-devel kernel-ib-devel; do rpm -q $$r 2>/dev/null | grep -q "^$$r" && echo "$$r" && break; done) +OFED_KERNEL_IB_DEVEL_DEB:=$(shell for p in mlnx-ofed-kernel-dkms; do dpkg-query -s "$$p" >/dev/null 2>&1 && echo "$$p" && break; done) +OFED_KERNEL_IB_DEVEL_PKG:=$(OFED_KERNEL_IB_DEVEL_RPM)$(OFED_KERNEL_IB_DEVEL_DEB) OFED_FLAVOR=$(shell if [ -e /usr/bin/ofed_info ]; then /usr/bin/ofed_info 2>/dev/null | head -n1 | sed -n 's/^\(MLNX_OFED\|OFED-internal\).*/MOFED/p;s/^OFED-.*/OFED/p'; else echo in-tree; fi) @@ -72,7 +76,9 @@ ifeq ($(OFED_FLAVOR),MOFED) # header files use the LINUX_BACKPORT() macro without including # , include that header file explicitly. OFED_KERNEL_DIR:=/usr/src/ofa_kernel/default -OFED_VERS=$(shell rpm -q --qf '%{version}\n' mlnx-ofa_kernel-devel 2>/dev/null | grep -v ' '; dpkg-query -W --showformat='$${Version}\n' mlnx-ofed-kernel-dkms 2>/dev/null) +OFED_RPM_VERS=$(shell rpm -q --qf '%{version}\n' mlnx-ofa_kernel-devel 2>/dev/null | grep -v ' ') +OFED_DEB_VERS=$(shell dpkg-query -W --showformat='$${Version}\n' mlnx-ofed-kernel-dkms 2>/dev/null) +OFED_VERS=$(OFED_RPM_VERS)$(OFED_DEB_VERS) OFED_CFLAGS:=-I$(OFED_KERNEL_DIR)/include -include "linux/compat-2.6.h" else # OFED 1.5 From 6d345cde85e1c6d314d30d7ff29110ac645c4693 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 10 Jul 2018 04:13:21 +0000 Subject: [PATCH 5/7] scst_vdisk: Suppress a gcc 8 warning about an intentional string truncation git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7408 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 224f5159e..1196554b1 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -4138,7 +4138,10 @@ static int vdisk_usn_vpd(uint8_t *buf, struct scst_cmd *cmd, read_lock(&vdisk_serial_rwlock); usn_len = strlen(virt_dev->usn); buf[3] = usn_len; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-truncation" strncpy(&buf[4], virt_dev->usn, usn_len); +#pragma GCC diagnostic pop read_unlock(&vdisk_serial_rwlock); } return buf[3] + 4; From b2416e0f490370aa6ba4383a9116216b7e0f4a30 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 10 Jul 2018 04:13:57 +0000 Subject: [PATCH 6/7] scst_local: Port to kernel v4.17 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7409 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 10 ++++++++++ scst_local/scst_local.c | 4 +--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/scst/include/backport.h b/scst/include/backport.h index 2f65a9061..dc14ab255 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -90,6 +90,16 @@ static inline unsigned int queue_max_hw_sectors(struct request_queue *q) } #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) +static inline void blk_queue_flag_set(unsigned int flag, + struct request_queue *q) +{ +#if !defined(RHEL_MAJOR) || RHEL_MAJOR -0 >= 6 + queue_flag_set_unlocked(flag, q); +#endif +} +#endif + /* */ #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 20) diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index 932ff9f2b..eef75fa97 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -1230,9 +1230,7 @@ static int scst_local_change_queue_depth(struct scsi_device *sdev, int qdepth) static int scst_local_slave_alloc(struct scsi_device *sdev) { -#if !defined(RHEL_MAJOR) || RHEL_MAJOR -0 >= 6 - queue_flag_set_unlocked(QUEUE_FLAG_BIDI, sdev->request_queue); -#endif + blk_queue_flag_set(QUEUE_FLAG_BIDI, sdev->request_queue); return 0; } From ff6864620b302e1293d09e199acbcd7e6596ee3a Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 10 Jul 2018 04:14:38 +0000 Subject: [PATCH 7/7] ib_srpt: Fix ch->max_sge calculation git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7410 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index a34cff61f..a29634d6b 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -2244,7 +2244,7 @@ retry: */ ch->max_sge = sdev->dev_attr.max_sge - min(max_sge_delta, - max_t(unsigned int, 0, + max_t(int, 0, sdev->dev_attr.max_sge - max_sge_delta)); qp_init->cap.max_send_sge = ch->max_sge; qp_init->cap.max_recv_sge = ch->max_sge;