diff --git a/.gitignore b/.gitignore index 1a531df..27bdfb3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /libiscsi-1.11.0.tar.gz /1.15.0.tar.gz /1.18.0.tar.gz +/libiscsi-20200224-git6ea30ae.tar.xz diff --git a/0001-Fix-compiler-warning-error-under-gcc7.patch b/0001-Fix-compiler-warning-error-under-gcc7.patch deleted file mode 100644 index 99ba46e..0000000 --- a/0001-Fix-compiler-warning-error-under-gcc7.patch +++ /dev/null @@ -1,25 +0,0 @@ -From: Ronnie Sahlberg -Date: Sat, 3 Jun 2017 11:20:20 -0700 -Subject: [PATCH] Fix compiler warning/error under gcc7 - -Gcc7 complains about falling through from the previous case to the default arm - -Signed-off-by: Ronnie Sahlberg -(cherry picked from commit 854e37aab7d7d2093a0a6620a3257b8f2a1d405c) ---- - test-tool/iscsi-support.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/test-tool/iscsi-support.c b/test-tool/iscsi-support.c -index 02367ca..ed00ce7 100644 ---- a/test-tool/iscsi-support.c -+++ b/test-tool/iscsi-support.c -@@ -2930,8 +2930,6 @@ void populate_ident_tgt_desc(unsigned char *buf, struct scsi_device *dev) - tgt_desig = desig; - prev_type = desig->designator_type; - } -- default: -- continue; - } - } - if (tgt_desig == NULL) { diff --git a/0002-Fix-another-compiler-warning.patch b/0002-Fix-another-compiler-warning.patch deleted file mode 100644 index e8aa623..0000000 --- a/0002-Fix-another-compiler-warning.patch +++ /dev/null @@ -1,43 +0,0 @@ -From: Ronnie Sahlberg -Date: Sat, 3 Jun 2017 11:33:51 -0700 -Subject: [PATCH] Fix another compiler warning - -We do need a default: arm here as the switch is not supposed to deal with -all possible values for the enum. - -Signed-off-by: Ronnie Sahlberg -(cherry picked from commit fb45f0343e3de45f2bc7516591d36c7466c2184e) ---- - test-tool/iscsi-support.c | 19 +++++++++++-------- - 1 file changed, 11 insertions(+), 8 deletions(-) - -diff --git a/test-tool/iscsi-support.c b/test-tool/iscsi-support.c -index ed00ce7..3f860ed 100644 ---- a/test-tool/iscsi-support.c -+++ b/test-tool/iscsi-support.c -@@ -2922,14 +2922,17 @@ void populate_ident_tgt_desc(unsigned char *buf, struct scsi_device *dev) - - for (desig = inq_di->designators; desig; desig = desig->next) { - switch (desig->designator_type) { -- case SCSI_DESIGNATOR_TYPE_VENDOR_SPECIFIC: -- case SCSI_DESIGNATOR_TYPE_T10_VENDORT_ID: -- case SCSI_DESIGNATOR_TYPE_EUI_64: -- case SCSI_DESIGNATOR_TYPE_NAA: -- if (prev_type <= desig->designator_type) { -- tgt_desig = desig; -- prev_type = desig->designator_type; -- } -+ case SCSI_DESIGNATOR_TYPE_VENDOR_SPECIFIC: -+ case SCSI_DESIGNATOR_TYPE_T10_VENDORT_ID: -+ case SCSI_DESIGNATOR_TYPE_EUI_64: -+ case SCSI_DESIGNATOR_TYPE_NAA: -+ if (prev_type <= desig->designator_type) { -+ tgt_desig = desig; -+ prev_type = desig->designator_type; -+ } -+ continue; -+ default: -+ continue; - } - } - if (tgt_desig == NULL) { diff --git a/0003-Fix-32bit-build.patch b/0003-Fix-32bit-build.patch deleted file mode 100644 index 7f6d462..0000000 --- a/0003-Fix-32bit-build.patch +++ /dev/null @@ -1,114 +0,0 @@ -From: Michal Suchanek -Date: Mon, 14 Nov 2016 17:28:31 +0100 -Subject: [PATCH] Fix 32bit build. - -Signed-off-by: Michal Suchanek -(cherry picked from commit a239423a0f9250dad9998152fa4b4b46accdf641) ---- - lib/iser.c | 7 ++++--- - test-tool/test_compareandwrite_invalid_dataout_size.c | 4 ++-- - test-tool/test_writesame10_invalid_dataout_size.c | 4 ++-- - test-tool/test_writesame16_invalid_dataout_size.c | 4 ++-- - 4 files changed, 10 insertions(+), 9 deletions(-) - -diff --git a/lib/iser.c b/lib/iser.c -index ad3adb3..17832c3 100644 ---- a/lib/iser.c -+++ b/lib/iser.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - #include "iscsi.h" - #include "iser-private.h" - #include "iscsi-private.h" -@@ -524,7 +525,7 @@ iser_prepare_read_cmd(struct iser_conn *iser_conn,struct iser_pdu *iser_pdu) - } - - tx_desc->data_dir = DATA_READ; -- hdr->read_va = htobe64((uint64_t)tx_desc->data_buff); -+ hdr->read_va = htobe64((intptr_t)tx_desc->data_buff); - hdr->read_stag = htobe32((uint32_t)tx_desc->data_mr->rkey); - hdr->flags |= ISER_RSV; - -@@ -565,7 +566,7 @@ iser_prepare_write_cmd(struct iser_conn *iser_conn, struct iser_pdu *iser_pdu) - - hdr->flags |= ISER_WSV; - hdr->write_stag = htobe32((uint32_t)(tx_desc->data_mr->rkey)); -- hdr->write_va = htobe64((uint64_t)(tx_desc->data_buff)); -+ hdr->write_va = htobe64((intptr_t)(tx_desc->data_buff)); - - return 0; - } -@@ -1146,7 +1147,7 @@ static int iser_handle_wc(struct ibv_wc *wc,struct iser_conn *iser_conn) - wc->wr_id, wc->status, wc->vendor_err); - return iscsi_service_reconnect_if_loggedin(iscsi); - } else { -- iscsi_set_error(iscsi, "flush error: wr id %lx\n", wc->wr_id); -+ iscsi_set_error(iscsi, "flush error: wr id %" PRIx64 "\n", wc->wr_id); - - return 0; - } -diff --git a/test-tool/test_compareandwrite_invalid_dataout_size.c b/test-tool/test_compareandwrite_invalid_dataout_size.c -index b27b4f8..76da1e0 100644 ---- a/test-tool/test_compareandwrite_invalid_dataout_size.c -+++ b/test-tool/test_compareandwrite_invalid_dataout_size.c -@@ -64,7 +64,7 @@ test_compareandwrite_invalid_dataout_size(void) - - - logging(LOG_VERBOSE, "Check too small DataOut"); -- logging(LOG_VERBOSE, "COMPAREANDWRITE with DataOut==%ld (4 blocks) " -+ logging(LOG_VERBOSE, "COMPAREANDWRITE with DataOut==%zd (4 blocks) " - "and TL == 1 ", 4 * block_size); - - new_tl = 1; -@@ -74,7 +74,7 @@ test_compareandwrite_invalid_dataout_size(void) - EXPECT_STATUS_GENERIC_BAD); - - logging(LOG_VERBOSE, "Check too large DataOut"); -- logging(LOG_VERBOSE, "COMPAREANDWRITE with DataOut==%ld (4 blocks) " -+ logging(LOG_VERBOSE, "COMPAREANDWRITE with DataOut==%zd (4 blocks) " - "and TL == 3 ", 4 * block_size); - - new_tl = 2; -diff --git a/test-tool/test_writesame10_invalid_dataout_size.c b/test-tool/test_writesame10_invalid_dataout_size.c -index f521908..119d786 100644 ---- a/test-tool/test_writesame10_invalid_dataout_size.c -+++ b/test-tool/test_writesame10_invalid_dataout_size.c -@@ -41,13 +41,13 @@ test_writesame10_invalid_dataout_size(void) - memset(scratch, 0xa6, block_size); - - logging(LOG_VERBOSE, "Check too small DataOut"); -- logging(LOG_VERBOSE, "Unmap with DataOut==%ld (block_size==%ld)", -+ logging(LOG_VERBOSE, "Unmap with DataOut==%zd (block_size==%zd)", - block_size / 2, block_size); - WRITESAME10(sd, 0, block_size / 2, 1, 0, 1, 0, 0, scratch, - EXPECT_STATUS_GENERIC_BAD); - - logging(LOG_VERBOSE, "Check too large DataOut"); -- logging(LOG_VERBOSE, "Unmap with DataOut==%ld (block_size==%ld)", -+ logging(LOG_VERBOSE, "Unmap with DataOut==%zd (block_size==%zd)", - block_size * 2, block_size); - WRITESAME10(sd, 0, block_size * 2, 1, 0, 1, 0, 0, scratch, - EXPECT_STATUS_GENERIC_BAD); -diff --git a/test-tool/test_writesame16_invalid_dataout_size.c b/test-tool/test_writesame16_invalid_dataout_size.c -index 128673f..a2e22bb 100644 ---- a/test-tool/test_writesame16_invalid_dataout_size.c -+++ b/test-tool/test_writesame16_invalid_dataout_size.c -@@ -41,13 +41,13 @@ test_writesame16_invalid_dataout_size(void) - memset(scratch, 0xa6, block_size); - - logging(LOG_VERBOSE, "Check too small DataOut"); -- logging(LOG_VERBOSE, "Unmap with DataOut==%ld (block_size==%ld)", -+ logging(LOG_VERBOSE, "Unmap with DataOut==%zd (block_size==%zd)", - block_size / 2, block_size); - WRITESAME16(sd, 0, block_size / 2, 1, 0, 1, 0, 0, scratch, - EXPECT_STATUS_GENERIC_BAD); - - logging(LOG_VERBOSE, "Check too large DataOut"); -- logging(LOG_VERBOSE, "Unmap with DataOut==%ld (block_size==%ld)", -+ logging(LOG_VERBOSE, "Unmap with DataOut==%zd (block_size==%zd)", - block_size * 2, block_size); - WRITESAME16(sd, 0, block_size * 2, 1, 0, 1, 0, 0, scratch, - EXPECT_STATUS_GENERIC_BAD); diff --git a/0004-iser-Use-local-container_of-definition.patch b/0004-iser-Use-local-container_of-definition.patch deleted file mode 100644 index cbf14ae..0000000 --- a/0004-iser-Use-local-container_of-definition.patch +++ /dev/null @@ -1,42 +0,0 @@ -From: Cole Robinson -Date: Mon, 30 Apr 2018 18:11:05 -0400 -Subject: [PATCH] iser: Use local container_of definition - -The code was implicitly dependent on container_of from -inifiniband/verbs.h, however that's been removed in rdma-core -latest release: - -https://github.com/linux-rdma/rdma-core/commit/ce0274acffc78ed2861a56bdc34cdd3d60c20e1f - -Define container_of locally if it's not already defined - -(cherry picked from commit f1feb218e2823d236569f0ca3cfad07334f2a304) ---- - lib/iser.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/lib/iser.c b/lib/iser.c -index 17832c3..aa7244c 100644 ---- a/lib/iser.c -+++ b/lib/iser.c -@@ -32,6 +32,20 @@ - #include - #include - -+ -+#ifndef container_of -+/** -+ * container_of - cast a member of a structure out to the containing structure -+ * @ptr: the pointer to the member. -+ * @type: the type of the container struct this is embedded in. -+ * @member: the name of the member within the struct. -+ * -+ */ -+#define container_of(ptr, type, member) \ -+ ((type *) ((uint8_t *)(ptr) - offsetof(type, member))) -+#endif -+ -+ - #ifdef __linux - - static int cq_handle(struct iser_conn *iser_conn); diff --git a/0005-fix-ipv6.patch b/0005-fix-ipv6.patch deleted file mode 100644 index 964f9f4..0000000 --- a/0005-fix-ipv6.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 179f6b33d43f26cbca133ff03fa1bacc7e8a6120 Mon Sep 17 00:00:00 2001 -From: Ronnie Sahlberg -Date: Sun, 8 Jan 2017 12:57:12 -0800 -Subject: [PATCH] Fix IPV6 - -Signed-off-by: Ronnie Sahlberg - -diff --git a/lib/socket.c b/lib/socket.c -index 926e474..41b68c0 100644 ---- a/lib/socket.c -+++ b/lib/socket.c -@@ -188,6 +188,20 @@ static int iscsi_tcp_connect(struct iscsi_context *iscsi, union socket_address * - - int socksize; - -+ switch (ai_family) { -+ case AF_INET: -+ socksize = sizeof(struct sockaddr_in); -+ break; -+ case AF_INET6: -+ socksize = sizeof(struct sockaddr_in6); -+ break; -+ default: -+ iscsi_set_error(iscsi, "Unknown address family :%d. " -+ "Only IPv4/IPv6 supported so far.", -+ ai_family); -+ return -1; -+ } -+ - iscsi->fd = socket(ai_family, SOCK_STREAM, 0); - if (iscsi->fd == -1) { - iscsi_set_error(iscsi, "Failed to open iscsi socket. " -@@ -246,8 +260,6 @@ static int iscsi_tcp_connect(struct iscsi_context *iscsi, union socket_address * - ISCSI_LOG(iscsi,3,"TCP_NODELAY set to 1"); - } - -- socksize = sizeof(struct sockaddr_in); // Work-around for now, need to fix it -- - if (connect(iscsi->fd, &sa->sa, socksize) != 0 - && errno != EINPROGRESS) { - iscsi_set_error(iscsi, "Connect failed with errno : " -@@ -332,6 +344,7 @@ iscsi_connect_async(struct iscsi_context *iscsi, const char *portal, - case AF_INET: - socksize = sizeof(struct sockaddr_in); - memcpy(&sa.sin, ai->ai_addr, socksize); -+ sa.sin.sin_family = AF_INET; - sa.sin.sin_port = htons(port); - #ifdef HAVE_SOCK_SIN_LEN - sa.sin.sin_len = socksize; -@@ -341,6 +354,7 @@ iscsi_connect_async(struct iscsi_context *iscsi, const char *portal, - case AF_INET6: - socksize = sizeof(struct sockaddr_in6); - memcpy(&sa.sin6, ai->ai_addr, socksize); -+ sa.sin6.sin6_family = AF_INET6; - sa.sin6.sin6_port = htons(port); - #ifdef HAVE_SOCK_SIN_LEN - sa.sin6.sin6_len = socksize; diff --git a/0006-fix-coverity-report.patch b/0006-fix-coverity-report.patch deleted file mode 100644 index 6feda02..0000000 --- a/0006-fix-coverity-report.patch +++ /dev/null @@ -1,156 +0,0 @@ -diff --git a/configure.ac b/configure.ac -index cf62b64..4001400 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -29,6 +29,7 @@ AC_ARG_ENABLE([werror], [AS_HELP_STRING([--disable-werror], - - if test "$ac_cv_prog_gcc" = yes; then - WARN_CFLAGS="-Wall -W -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wno-strict-aliasing" -+ WARN_CFLAGS="$WARN_CFLAGS -Wno-unknown-warning-option -Wno-stringop-truncation" - if test "x$enable_werror" != "xno"; then - WARN_CFLAGS="$WARN_CFLAGS -Werror" - fi -diff --git a/lib/iser.c b/lib/iser.c -index 898d6b5..d140ad6 100644 ---- a/lib/iser.c -+++ b/lib/iser.c -@@ -964,7 +964,7 @@ iser_post_recvm(struct iser_conn *iser_conn, int count) - iser_conn->post_recv_buf_count += count; - ret = ibv_post_recv(iser_conn->qp, iser_conn->rx_wr, &rx_wr_failed); - if (ret) { -- iscsi_set_error(iscsi, "ib_post_recv failed ret=%d", ret); -+ iscsi_set_error(iscsi, "posting %d rx bufs, ib_post_recv failed ret=%d", count, ret); - iser_conn->post_recv_buf_count -= count; - } else - iser_conn->rx_desc_head = my_rx_head; -@@ -1028,7 +1028,7 @@ iser_rcv_completion(struct iser_rx_desc *rx_desc, - struct iser_conn *iser_conn) - { - struct iscsi_in_pdu *in = NULL; -- int outstanding, count = 0, err; -+ int empty, err; - struct iscsi_context *iscsi = iser_conn->cma_id->context; - - in = iscsi_malloc(iscsi, sizeof(*in)); -@@ -1037,12 +1037,13 @@ iser_rcv_completion(struct iser_rx_desc *rx_desc, - if (iscsi->session_type == ISCSI_SESSION_NORMAL) { - if(iser_alloc_rx_descriptors(iser_conn,255)) { - iscsi_set_error(iscsi, "iser_alloc_rx_descriptors Failed\n"); -- return -1; -+ err = -1; -+ goto error; - } - err = iser_post_recvm(iser_conn, ISER_MIN_POSTED_RX); - if (err) { -- iscsi_set_error(iscsi, "posting %d rx bufs err %d", count, err); -- return -1; -+ err = -1; -+ goto error; - } - } - in->hdr = (unsigned char*)rx_desc->iscsi_header; -@@ -1089,34 +1090,27 @@ iser_rcv_completion(struct iser_rx_desc *rx_desc, - ISCSI_LIST_ADD_END(&iser_conn->tx_desc, iser_pdu->desc); - - nop_target: -- - /* decrementing conn->post_recv_buf_count only --after-- freeing the * - * task eliminates the need to worry on tasks which are completed in * - * parallel to the execution of iser_conn_term. So the code that waits * - * for the posted rx bufs refcount to become zero handles everything */ - iser_conn->post_recv_buf_count--; - -- if ((unsigned char *)rx_desc == iser_conn->login_resp_buf) -- goto receive; -- -- outstanding = iser_conn->post_recv_buf_count; -- if (outstanding + iser_conn->min_posted_rx <= iser_conn->qp_max_recv_dtos) { -- if(iser_conn->qp_max_recv_dtos - outstanding > iser_conn->min_posted_rx) -- count = iser_conn->min_posted_rx; -- else -- count = iser_conn->qp_max_recv_dtos - outstanding; -- err = iser_post_recvm(iser_conn, count); -- if (err) { -- iscsi_set_error(iscsi, "posting %d rx bufs err %d", count, err); -- return -1; -+ if ((unsigned char *)rx_desc != iser_conn->login_resp_buf) { -+ empty = iser_conn->qp_max_recv_dtos - iser_conn->post_recv_buf_count; -+ if (empty >= iser_conn->min_posted_rx) { -+ err = iser_post_recvm(iser_conn, empty); -+ if (err) { -+ err = -1; -+ goto error; -+ } - } - } - --receive: -- - err = iscsi_process_pdu(iscsi, in); -- iscsi_free(iscsi, in); - -+error: -+ iscsi_free(iscsi, in); - return err; - } - -diff --git a/lib/logging.c b/lib/logging.c -index be518fc..61c7440 100644 ---- a/lib/logging.c -+++ b/lib/logging.c -@@ -73,9 +73,9 @@ iscsi_log_message(struct iscsi_context *iscsi, int level, const char *format, .. - } - - if (iscsi->target_name[0]) { -- static char message2[1024]; -+ static char message2[1282]; - -- snprintf(message2, 1024, "%s [%s]", message, iscsi->target_name); -+ snprintf(message2, 1282, "%s [%s]", message, iscsi->target_name); - iscsi->log_fn(level, message2); - } - else -diff --git a/lib/scsi-lowlevel.c b/lib/scsi-lowlevel.c -index 5ddd709..747ce0c 100644 ---- a/lib/scsi-lowlevel.c -+++ b/lib/scsi-lowlevel.c -@@ -1086,6 +1086,7 @@ scsi_maintenancein_datain_getfullsize(struct scsi_task *task) - (task_get_uint8(task, 1) & 0x80) ? 12 : 0 + - task_get_uint16(task, 2); - } -+ return -1; - default: - return -1; - } -diff --git a/lib/sync.c b/lib/sync.c -index f8a139c..0ceb0cb 100644 ---- a/lib/sync.c -+++ b/lib/sync.c -@@ -88,10 +88,8 @@ iscsi_sync_cb(struct iscsi_context *iscsi _U_, int status, - { - struct iscsi_sync_state *state = private_data; - -- if (state != NULL) { -- state->status = status; -- state->finished = 1; -- } -+ state->status = status; -+ state->finished = 1; - } - - int -@@ -1871,11 +1869,9 @@ iscsi_discovery_cb(struct iscsi_context *iscsi _U_, int status, - } - } - -- if (state != NULL) { -- state->status = status; -- state->finished = 1; -- state->ptr = dahead; -- } -+ state->status = status; -+ state->finished = 1; -+ state->ptr = dahead; - } - - struct iscsi_discovery_address * diff --git a/libiscsi.spec b/libiscsi.spec index 33e972c..e1f275b 100644 --- a/libiscsi.spec +++ b/libiscsi.spec @@ -1,22 +1,12 @@ Name: libiscsi Summary: iSCSI client library -Version: 1.18.0 -Release: 10%{?dist} +Version: 1.19.0 +Release: 1%{?dist} License: LGPLv2+ URL: https://github.com/sahlberg/%{name} -Source: https://github.com/sahlberg/%{name}/archive/%{version}.tar.gz - -# Fix gcc7 warnings -Patch0001: 0001-Fix-compiler-warning-error-under-gcc7.patch -Patch0002: 0002-Fix-another-compiler-warning.patch -# Fix 32bit build -Patch0003: 0003-Fix-32bit-build.patch -# Fix build with latest rdma-core -# Submitted upstream: https://github.com/sahlberg/libiscsi/pull/265 -Patch0004: 0004-iser-Use-local-container_of-definition.patch -Patch0005: 0005-fix-ipv6.patch -Patch0006: 0006-fix-coverity-report.patch +#Source: https://github.com/sahlberg/libiscsi/archive/{version}.tar.gz +Source: libiscsi-20200224-git6ea30ae.tar.xz BuildRequires: autoconf BuildRequires: automake @@ -56,11 +46,6 @@ echo %{libiscsi_libdir} > $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.conf rm $RPM_BUILD_ROOT/%{libiscsi_libdir}/libiscsi.a rm $RPM_BUILD_ROOT/%{libiscsi_libdir}/libiscsi.la -# Remove "*.old" files -find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \; - -# Remove library put in /usr/bin -rm $RPM_BUILD_ROOT/%{_bindir}/ld_iscsi.so %post -p /sbin/ldconfig @@ -70,6 +55,7 @@ rm $RPM_BUILD_ROOT/%{_bindir}/ld_iscsi.so %license COPYING LICENCE-LGPL-2.1.txt %doc README TODO %dir %{libiscsi_libdir} +%{libiscsi_libdir}/libiscsi.so.9 %{libiscsi_libdir}/libiscsi.so.* %config /etc/ld.so.conf.d/* diff --git a/sources b/sources index 5afc660..5ec0128 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (1.18.0.tar.gz) = 9869fd86f8ba237d71256b16d0f94ef69fb67fac315bb7a596c4d8d6ed3abba710edf9b5f5a27f5777f7b5d2feb33c09764c27a4e6c56e38dd2566836cffe36e +SHA512 (libiscsi-20200224-git6ea30ae.tar.xz) = 425b15c21f4078f9c4ce761595438c340c468cee59aa56c4f4a7890a7dc8f50385041d8e5cf134e50ece8b189763b929f2432cd58359689c04386a0c4d00cb50