libiscsi: update to v1.19.0

libiscsi: update to v1.19.0

Signed-off-by: Zhiqiang Liu <lzhq28@mail.ustc.edu.cn>
This commit is contained in:
ZhiqiangLiu 2020-07-15 21:44:07 +08:00 committed by Zhiqiang Liu
parent 8f9fc098b3
commit bb63df2c8c
9 changed files with 5 additions and 352 deletions

View File

@ -1,25 +0,0 @@
From: Ronnie Sahlberg <ronniesahlberg@gmail.com>
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 <ronniesahlberg@gmail.com>
(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) {

View File

@ -1,43 +0,0 @@
From: Ronnie Sahlberg <ronniesahlberg@gmail.com>
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 <ronniesahlberg@gmail.com>
(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) {

View File

@ -1,114 +0,0 @@
From: Michal Suchanek <msuchanek@suse.de>
Date: Mon, 14 Nov 2016 17:28:31 +0100
Subject: [PATCH] Fix 32bit build.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
(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 <string.h>
#include <stdbool.h>
#include <unistd.h>
+#include <inttypes.h>
#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);

View File

@ -1,42 +0,0 @@
From: Cole Robinson <crobinso@redhat.com>
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 <semaphore.h>
#include <poll.h>
+
+#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);

View File

@ -1,41 +0,0 @@
From 63cfcd3384f6ab35a7d1f3d82dd824fb1872d657 Mon Sep 17 00:00:00 2001
From: optimistyzy <optimistyzy@gmail.com>
Date: Mon, 9 Jan 2017 18:34:12 +0800
Subject: [PATCH 035/110] iscsi-perf: fix overflow issue in fill_read_queue
If with int defintion, this statement:
num_blocks = client->num_blocks - client->pos;
May not get the exact value we want.
Signed-off-by: optimistyzy <optimistyzy@gmail.com>
---
utils/iscsi-perf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/utils/iscsi-perf.c b/utils/iscsi-perf.c
index 14c3f49..7e0f145 100644
--- a/utils/iscsi-perf.c
+++ b/utils/iscsi-perf.c
@@ -186,7 +186,7 @@ out:
void fill_read_queue(struct client *client)
{
- int num_blocks;
+ int64_t num_blocks;
if (finished) return;
@@ -210,7 +210,7 @@ void fill_read_queue(struct client *client)
task = iscsi_read16_task(client->iscsi,
client->lun, client->pos,
- num_blocks * client->blocksize,
+ (uint32_t)(num_blocks * client->blocksize),
client->blocksize, 0, 0, 0, 0, 0,
cb, client);
if (task == NULL) {
--
1.8.3.1

View File

@ -1,78 +0,0 @@
From b5210a1e31afb9f0adf369cde11c612f3365432e Mon Sep 17 00:00:00 2001
From: Peter Lieven <pl@kamp.de>
Date: Mon, 23 Jan 2017 15:40:09 +0100
Subject: [PATCH 036/110] sync: fix return value for various sync commands
all sync commands that return an integer value are
supposed to return a negative value on error.
However, state.status is positive non-zero on error.
Fix this by returning -1 if the state.status is
not SCSI_STATUS_GOOD.
Reported-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
---
lib/sync.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/sync.c b/lib/sync.c
index 3b907c0..0e4d42b 100644
--- a/lib/sync.c
+++ b/lib/sync.c
@@ -111,7 +111,7 @@ iscsi_connect_sync(struct iscsi_context *iscsi, const char *portal)
/* clear connect_data so it doesnt point to our stack */
iscsi->connect_data = NULL;
- return state.status;
+ return (state.status == SCSI_STATUS_GOOD) ? 0 : -1;
}
int
@@ -132,7 +132,7 @@ iscsi_full_connect_sync(struct iscsi_context *iscsi,
event_loop(iscsi, &state);
- return state.status;
+ return (state.status == SCSI_STATUS_GOOD) ? 0 : -1;
}
int iscsi_login_sync(struct iscsi_context *iscsi)
@@ -149,7 +149,7 @@ int iscsi_login_sync(struct iscsi_context *iscsi)
event_loop(iscsi, &state);
- return state.status;
+ return (state.status == SCSI_STATUS_GOOD) ? 0 : -1;
}
int iscsi_logout_sync(struct iscsi_context *iscsi)
@@ -166,7 +166,7 @@ int iscsi_logout_sync(struct iscsi_context *iscsi)
event_loop(iscsi, &state);
- return state.status;
+ return (state.status == SCSI_STATUS_GOOD) ? 0 : -1;
}
static void
@@ -213,7 +213,7 @@ int iscsi_reconnect_sync(struct iscsi_context *iscsi)
reconnect_event_loop(iscsi, &state);
- return state.status;
+ return (state.status == SCSI_STATUS_GOOD) ? 0 : -1;
}
static void
@@ -270,7 +270,7 @@ iscsi_task_mgmt_sync(struct iscsi_context *iscsi,
event_loop(iscsi, &state);
- return state.status;
+ return (state.status == SCSI_STATUS_GOOD) ? 0 : -1;
}
int
--
1.8.3.1

Binary file not shown.

BIN
1.19.0.tar.gz Normal file

Binary file not shown.

View File

@ -1,19 +1,12 @@
Name: libiscsi
Version: 1.18.0
Release: 7
Version: 1.19.0
Release: 1
Summary: Client-side library to implement the iSCSI protocol
License: LGPLv2+ and GPLv2+
URL: https://github.com/sahlberg/%{name}
Source: https://github.com/sahlberg/%{name}/archive/%{version}.tar.gz
Patch0: 0000-Fix-compiler-warning-error-under-gcc7.patch
Patch1: 0001-Fix-another-compiler-warning.patch
Patch2: 0002-Fix-32bit-build.patch
Patch3: 0003-iser-Use-local-container_of-definition.patch
Patch4: 0004-iscsi-perf-fix-overflow-issue-in-fill_read_queue.patch
Patch5: 0005-sync-fix-return-value-for-various-sync-commands.patch
BuildRequires: gcc git
BuildRequires: autoconf automake libtool popt-devel CUnit-devel libgcrypt-devel rdma-core-devel chrpath
@ -102,6 +95,9 @@ This package contains the help info for %{name}.
%{_mandir}/man1/iscsi-test-cu.1.gz
%changelog
* Wed Jul 15 2020 Zhiqiang Liu <lzhq28@mail.ustc.edu.cn> - 1.19.0-1
- update to v1.19.0 version
* Tue Jun 30 2020 volcanodragon <linfeilong@huawei.com> - 1.18.0-7
- Type:enhancement
- ID:NA