!95 [sync] PR-94: 高版本补丁分析合入
From: @openeuler-sync-bot Reviewed-by: @liuzhiqiang26 Signed-off-by: @liuzhiqiang26
This commit is contained in:
commit
a6df9170e0
75
0017-iscsi-sysfs-check-state-before-onlining-devs.patch
Normal file
75
0017-iscsi-sysfs-check-state-before-onlining-devs.patch
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
From 245a547c61a9356cdb7dba0032c09ad58c17143b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mike Christie <michael.christie@oracle.com>
|
||||||
|
Date: Fri, 5 Nov 2021 16:33:20 -0500
|
||||||
|
Subject: [PATCH] iscsi sysfs: check state before onlining devs
|
||||||
|
|
||||||
|
In 5.6, the commit:
|
||||||
|
|
||||||
|
commit 0ab710458da113a71c461c4df27e7f1353d9f864
|
||||||
|
Author: Bharath Ravi <rbharath@google.com>
|
||||||
|
Date: Sat Jan 25 01:19:25 2020 -0500
|
||||||
|
|
||||||
|
scsi: iscsi: Perform connection failure entirely in kernel space
|
||||||
|
|
||||||
|
made it so the kernel can start the recovery process. This means that
|
||||||
|
after the start conn operation the kernel could set the device into the
|
||||||
|
block stated. We can then hit a race where iscsid has done start conn,
|
||||||
|
and is calling session_online_devs but the kernel has hit an issue and is
|
||||||
|
now setting the device's to blocked.
|
||||||
|
|
||||||
|
This adds a check for if the device is in the offline state before trying
|
||||||
|
to set the state to running.
|
||||||
|
---
|
||||||
|
usr/iscsi_sysfs.c | 25 ++++++++++++++++++++++++-
|
||||||
|
1 file changed, 24 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
|
||||||
|
index abefde2..7bb834a 100644
|
||||||
|
--- a/usr/iscsi_sysfs.c
|
||||||
|
+++ b/usr/iscsi_sysfs.c
|
||||||
|
@@ -1929,18 +1929,41 @@ void iscsi_sysfs_set_queue_depth(void *data, int hostno, int target, int lun)
|
||||||
|
void iscsi_sysfs_set_device_online(__attribute__((unused))void *data,
|
||||||
|
int hostno, int target, int lun)
|
||||||
|
{
|
||||||
|
- char *write_buf = "running\n";
|
||||||
|
+ char *write_buf = "running\n", *state;
|
||||||
|
char id[NAME_SIZE];
|
||||||
|
int err;
|
||||||
|
|
||||||
|
snprintf(id, sizeof(id), "%d:0:%d:%d", hostno, target, lun);
|
||||||
|
log_debug(4, "online device %s", id);
|
||||||
|
|
||||||
|
+ state = sysfs_get_value(id, SCSI_SUBSYS, "state");
|
||||||
|
+ if (!state) {
|
||||||
|
+ log_error("Could not read state for LUN %s\n", id);
|
||||||
|
+ goto set_state;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!strcmp(state, "running"))
|
||||||
|
+ goto done;
|
||||||
|
+ /*
|
||||||
|
+ * The kernel can start to perform session level recovery cleanup
|
||||||
|
+ * any time after the conn start call, so we only want to change the
|
||||||
|
+ * state if we are in one of the offline states.
|
||||||
|
+ */
|
||||||
|
+ if (strcmp(state, "offline") && strcmp(state, "transport-offline")) {
|
||||||
|
+ log_debug(4, "Dev not offline. Skip onlining %s", id);
|
||||||
|
+ goto done;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+set_state:
|
||||||
|
err = sysfs_set_param(id, SCSI_SUBSYS, "state", write_buf,
|
||||||
|
strlen(write_buf));
|
||||||
|
if (err && err != EINVAL)
|
||||||
|
/* we should read the state */
|
||||||
|
log_error("Could not online LUN %d err %d.", lun, err);
|
||||||
|
+
|
||||||
|
+done:
|
||||||
|
+ if (state)
|
||||||
|
+ free(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
void iscsi_sysfs_rescan_device(__attribute__((unused))void *data,
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
From 6c54bf1ee7cd3f31cd0f55459809e739fe9a85de Mon Sep 17 00:00:00 2001
|
||||||
|
From: Wenchao Hao <haowenchao@huawei.com>
|
||||||
|
Date: Fri, 19 Nov 2021 22:21:58 +0800
|
||||||
|
Subject: [PATCH] iscsiadm: Call log_init() first to fix a segmentation fault
|
||||||
|
|
||||||
|
log_init() should be called before log_error()
|
||||||
|
|
||||||
|
Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
|
||||||
|
---
|
||||||
|
usr/iscsiadm.c | 5 +++--
|
||||||
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
|
||||||
|
index 192da66..0467db5 100644
|
||||||
|
--- a/usr/iscsiadm.c
|
||||||
|
+++ b/usr/iscsiadm.c
|
||||||
|
@@ -3599,6 +3599,9 @@ main(int argc, char **argv)
|
||||||
|
struct iscsi_session *se = NULL;
|
||||||
|
bool wait = true;
|
||||||
|
|
||||||
|
+ /* enable stdout logging */
|
||||||
|
+ log_init(program_name, 1024, log_do_log_std, NULL);
|
||||||
|
+
|
||||||
|
ctx = iscsi_context_new();
|
||||||
|
if (ctx == NULL) {
|
||||||
|
log_error("No memory");
|
||||||
|
@@ -3616,8 +3619,6 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
|
umask(0077);
|
||||||
|
|
||||||
|
- /* enable stdout logging */
|
||||||
|
- log_init(program_name, 1024, log_do_log_std, NULL);
|
||||||
|
sysfs_init();
|
||||||
|
|
||||||
|
optopt = 0;
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
98
0019-Fix-issues-discovered-by-gcc12.patch
Normal file
98
0019-Fix-issues-discovered-by-gcc12.patch
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
From 151e701d08e16dce545d017e57c3d5ac957b7c1e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lee Duncan <lduncan@suse.com>
|
||||||
|
Date: Tue, 25 Jan 2022 10:11:58 -0800
|
||||||
|
Subject: [PATCH] Fix issues discovered by gcc12
|
||||||
|
|
||||||
|
Gcc-12 caught a few errors in the code where we were checking
|
||||||
|
for an array being empty incorrectly, so this commit fixes those.
|
||||||
|
---
|
||||||
|
usr/auth.c | 3 +--
|
||||||
|
usr/login.c | 18 +++++++++---------
|
||||||
|
2 files changed, 10 insertions(+), 11 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/usr/auth.c b/usr/auth.c
|
||||||
|
index 2f7506f..46c328e 100644
|
||||||
|
--- a/usr/auth.c
|
||||||
|
+++ b/usr/auth.c
|
||||||
|
@@ -109,7 +109,7 @@ acl_chap_auth_request(struct iscsi_acl *client, char *username, unsigned int id,
|
||||||
|
unsigned char verify_data[client->chap_challenge_len];
|
||||||
|
|
||||||
|
/* the expected credentials are in the session */
|
||||||
|
- if (session->username_in == NULL) {
|
||||||
|
+ if (session->username_in[0] == '\0') {
|
||||||
|
log_error("failing authentication, no incoming username "
|
||||||
|
"configured to authenticate target %s",
|
||||||
|
session->target_name);
|
||||||
|
@@ -122,7 +122,6 @@ acl_chap_auth_request(struct iscsi_acl *client, char *username, unsigned int id,
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((session->password_in_length < 1) ||
|
||||||
|
- (session->password_in == NULL) ||
|
||||||
|
(session->password_in[0] == '\0')) {
|
||||||
|
log_error("failing authentication, no incoming password "
|
||||||
|
"configured to authenticate target %s",
|
||||||
|
diff --git a/usr/login.c b/usr/login.c
|
||||||
|
index 8af8756..096deda 100644
|
||||||
|
--- a/usr/login.c
|
||||||
|
+++ b/usr/login.c
|
||||||
|
@@ -657,7 +657,7 @@ iscsi_process_login_response(iscsi_session_t *session, int cid,
|
||||||
|
struct iscsi_acl *auth_client;
|
||||||
|
iscsi_conn_t *conn = &session->conn[cid];
|
||||||
|
|
||||||
|
- auth_client = (session->auth_buffers && session->num_auth_buffers) ?
|
||||||
|
+ auth_client = (session->num_auth_buffers > 0) ?
|
||||||
|
(struct iscsi_acl *)session->auth_buffers[0].address : NULL;
|
||||||
|
|
||||||
|
end = text + ntoh24(login_rsp->dlength) + 1;
|
||||||
|
@@ -1135,7 +1135,7 @@ iscsi_make_login_pdu(iscsi_session_t *session, int cid, struct iscsi_hdr *hdr,
|
||||||
|
struct iscsi_acl *auth_client;
|
||||||
|
iscsi_conn_t *conn = &session->conn[cid];
|
||||||
|
|
||||||
|
- auth_client = (session->auth_buffers && session->num_auth_buffers) ?
|
||||||
|
+ auth_client = (session->num_auth_buffers > 0) ?
|
||||||
|
(struct iscsi_acl *)session->auth_buffers[0].address : NULL;
|
||||||
|
|
||||||
|
/* initialize the PDU header */
|
||||||
|
@@ -1170,7 +1170,7 @@ iscsi_make_login_pdu(iscsi_session_t *session, int cid, struct iscsi_hdr *hdr,
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if ((session->target_name && session->target_name[0]) &&
|
||||||
|
+ if ((session->target_name[0] != '\0') &&
|
||||||
|
(session->type == ISCSI_SESSION_TYPE_NORMAL)) {
|
||||||
|
if (!iscsi_add_text(hdr, data, max_data_length,
|
||||||
|
"TargetName", session->target_name))
|
||||||
|
@@ -1248,16 +1248,16 @@ check_for_authentication(iscsi_session_t *session,
|
||||||
|
return LOGIN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (session->username &&
|
||||||
|
+ if ((session->username[0] != '\0') &&
|
||||||
|
(acl_set_user_name(auth_client, session->username) !=
|
||||||
|
- AUTH_STATUS_NO_ERROR)) {
|
||||||
|
+ AUTH_STATUS_NO_ERROR)) {
|
||||||
|
log_error("Couldn't set username");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (session->password && (acl_set_passwd(auth_client,
|
||||||
|
- session->password, session->password_length) !=
|
||||||
|
- AUTH_STATUS_NO_ERROR)) {
|
||||||
|
+ if ((session->password[0] != '\0') &&
|
||||||
|
+ (acl_set_passwd(auth_client, session->password, session->password_length) !=
|
||||||
|
+ AUTH_STATUS_NO_ERROR)) {
|
||||||
|
log_error("Couldn't set password");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
@@ -1366,7 +1366,7 @@ iscsi_login_begin(iscsi_session_t *session, iscsi_login_context_t *c)
|
||||||
|
conn->current_stage = ISCSI_INITIAL_LOGIN_STAGE;
|
||||||
|
conn->partial_response = 0;
|
||||||
|
|
||||||
|
- if (session->auth_buffers && session->num_auth_buffers) {
|
||||||
|
+ if (session->num_auth_buffers > 0) {
|
||||||
|
c->ret = check_for_authentication(session, c->auth_client);
|
||||||
|
if (c->ret != LOGIN_OK)
|
||||||
|
return 1;
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
44
0020-Fix-more-issues-discovered-by-gcc12.patch
Normal file
44
0020-Fix-more-issues-discovered-by-gcc12.patch
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
From 1cab1efc813f750f9fa68e35dc16e8e54a1ba1e8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lee Duncan <lduncan@suse.com>
|
||||||
|
Date: Wed, 26 Jan 2022 11:44:09 -0800
|
||||||
|
Subject: [PATCH] Fix more issues discovered by gcc12
|
||||||
|
|
||||||
|
Gcc-12 caught a few more errors in the code, where we are
|
||||||
|
still checking an array address for NULL, which will never
|
||||||
|
happen.
|
||||||
|
---
|
||||||
|
usr/discovery.c | 2 +-
|
||||||
|
usr/iscsi_sysfs.c | 4 ++--
|
||||||
|
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/usr/discovery.c b/usr/discovery.c
|
||||||
|
index 7dec696..587af6d 100644
|
||||||
|
--- a/usr/discovery.c
|
||||||
|
+++ b/usr/discovery.c
|
||||||
|
@@ -623,7 +623,7 @@ add_target_record(char *name, char *end, discovery_rec_t *drec,
|
||||||
|
|
||||||
|
/* if no address is provided, use the default */
|
||||||
|
if (text >= end) {
|
||||||
|
- if (drec->address == NULL) {
|
||||||
|
+ if (drec->address[0] == '\0') {
|
||||||
|
log_error("no default address known for target %s",
|
||||||
|
name);
|
||||||
|
return 0;
|
||||||
|
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
|
||||||
|
index 7bb834a..9a591be 100644
|
||||||
|
--- a/usr/iscsi_sysfs.c
|
||||||
|
+++ b/usr/iscsi_sysfs.c
|
||||||
|
@@ -1416,8 +1416,8 @@ int iscsi_sysfs_get_sessioninfo_by_id(struct session_info *info, char *session)
|
||||||
|
log_debug(7, "found targetname %s address %s pers address %s port %d "
|
||||||
|
"pers port %d driver %s iface name %s ipaddress %s "
|
||||||
|
"netdev %s hwaddress %s iname %s",
|
||||||
|
- info->targetname, info->address ? info->address : "NA",
|
||||||
|
- info->persistent_address ? info->persistent_address : "NA",
|
||||||
|
+ info->targetname, info->address[0] ? info->address : "NA",
|
||||||
|
+ info->persistent_address[0] ? info->persistent_address : "NA",
|
||||||
|
info->port, info->persistent_port, info->iface.transport_name,
|
||||||
|
info->iface.name, info->iface.ipaddress,
|
||||||
|
info->iface.netdev, info->iface.hwaddress,
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
From 0b9675a2263174060b11e459fcfd554b10f9ca1e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Wenchao Hao <haowenchao@huawei.com>
|
||||||
|
Date: Wed, 2 Feb 2022 12:13:16 +0800
|
||||||
|
Subject: [PATCH] actor: enhanced: print error log when init a initilized
|
||||||
|
thread
|
||||||
|
|
||||||
|
This is only a enhance, do not change origin logic
|
||||||
|
|
||||||
|
Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
|
||||||
|
---
|
||||||
|
usr/actor.c | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/usr/actor.c b/usr/actor.c
|
||||||
|
index dc008a7..a6bb02f 100644
|
||||||
|
--- a/usr/actor.c
|
||||||
|
+++ b/usr/actor.c
|
||||||
|
@@ -45,6 +45,10 @@ actor_time_left(actor_t *thread, time_t current_time)
|
||||||
|
void
|
||||||
|
actor_init(actor_t *thread, void (*callback)(void *), void *data)
|
||||||
|
{
|
||||||
|
+ if (thread->state != ACTOR_INVALID)
|
||||||
|
+ log_error("bug:thread %p has already been initialized",
|
||||||
|
+ thread);
|
||||||
|
+
|
||||||
|
INIT_LIST_HEAD(&thread->list);
|
||||||
|
thread->state = ACTOR_NOTSCHEDULED;
|
||||||
|
thread->callback = callback;
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
From d4a13200efd215d5b115db60f075921c5e67cc57 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Wenchao Hao <haowenchao@huawei.com>
|
||||||
|
Date: Wed, 2 Feb 2022 16:09:05 +0800
|
||||||
|
Subject: [PATCH] initiator_common: make set operational parameter log easy to
|
||||||
|
read
|
||||||
|
|
||||||
|
iscsid would print log like following if debug level is larger than 3:
|
||||||
|
|
||||||
|
iscsid: set operational parameter 35 to:
|
||||||
|
iscsid: 30
|
||||||
|
iscsid: set operational parameter 30 to:
|
||||||
|
iscsid: 5
|
||||||
|
|
||||||
|
which is not friendly to read, this commit makes it easy to read,
|
||||||
|
like this:
|
||||||
|
|
||||||
|
iscsid: set operational parameter 35 to: 30
|
||||||
|
iscsid: set operational parameter 30 to: 5
|
||||||
|
|
||||||
|
Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
|
||||||
|
---
|
||||||
|
usr/initiator_common.c | 6 ++----
|
||||||
|
1 file changed, 2 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/usr/initiator_common.c b/usr/initiator_common.c
|
||||||
|
index 6cf26c1..bc69fbd 100644
|
||||||
|
--- a/usr/initiator_common.c
|
||||||
|
+++ b/usr/initiator_common.c
|
||||||
|
@@ -273,12 +273,10 @@ static int host_set_param(struct iscsi_transport *t,
|
||||||
|
|
||||||
|
static void print_param_value(enum iscsi_param param, void *value, int type)
|
||||||
|
{
|
||||||
|
- log_debug(3, "set operational parameter %d to:", param);
|
||||||
|
-
|
||||||
|
if (type == ISCSI_STRING)
|
||||||
|
- log_debug(3, "%s", value ? (char *)value : "NULL");
|
||||||
|
+ log_debug(3, "set operational parameter %d to %s", param, value ? (char *)value : "NULL");
|
||||||
|
else
|
||||||
|
- log_debug(3, "%u", *(uint32_t *)value);
|
||||||
|
+ log_debug(3, "set operational parameter %d to %u", param, *(uint32_t *)value);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define MAX_HOST_PARAMS 2
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
Name: open-iscsi
|
Name: open-iscsi
|
||||||
Version: 2.1.5
|
Version: 2.1.5
|
||||||
Release: 6
|
Release: 7
|
||||||
Summary: ISCSI software initiator daemon and utility programs
|
Summary: ISCSI software initiator daemon and utility programs
|
||||||
License: GPLv2+ and BSD
|
License: GPLv2+ and BSD
|
||||||
URL: http://www.open-iscsi.com
|
URL: http://www.open-iscsi.com
|
||||||
@ -25,6 +25,12 @@ patch13: 0013-Remove-iscsiuio-from-build-and-install-recipe.patch
|
|||||||
patch14: 0014-Remove-iscsiuio-source-code.patch
|
patch14: 0014-Remove-iscsiuio-source-code.patch
|
||||||
patch15: 0015-Remove-iscsiuio-from-config-and-service-file.patch
|
patch15: 0015-Remove-iscsiuio-from-config-and-service-file.patch
|
||||||
patch16: 0016-Remove-iscsi-init.service-from-iscsi-and-iscsid-serv.patch
|
patch16: 0016-Remove-iscsi-init.service-from-iscsi-and-iscsid-serv.patch
|
||||||
|
patch17: 0017-iscsi-sysfs-check-state-before-onlining-devs.patch
|
||||||
|
patch18: 0018-iscsiadm-Call-log_init-first-to-fix-a-segmentation-f.patch
|
||||||
|
patch19: 0019-Fix-issues-discovered-by-gcc12.patch
|
||||||
|
patch20: 0020-Fix-more-issues-discovered-by-gcc12.patch
|
||||||
|
patch21: 0021-actor-enhanced-print-error-log-when-init-a-initilize.patch
|
||||||
|
patch22: 0022-initiator_common-make-set-operational-parameter-log-.patch
|
||||||
|
|
||||||
BuildRequires: flex bison doxygen kmod-devel systemd-units gcc git isns-utils-devel systemd-devel
|
BuildRequires: flex bison doxygen kmod-devel systemd-units gcc git isns-utils-devel systemd-devel
|
||||||
BuildRequires: autoconf automake libtool libmount-devel openssl-devel pkg-config
|
BuildRequires: autoconf automake libtool libmount-devel openssl-devel pkg-config
|
||||||
@ -151,6 +157,9 @@ fi
|
|||||||
%{_mandir}/man8/*
|
%{_mandir}/man8/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Feb 18 2022 wubo <wubo40@huawei.com> - 2.1.5-7
|
||||||
|
- Backport bugfix patches
|
||||||
|
|
||||||
* Tue Feb 8 2022 haowenchao <haowenchao@huawei.com> - 2.1.5-6
|
* Tue Feb 8 2022 haowenchao <haowenchao@huawei.com> - 2.1.5-6
|
||||||
- Remove useless patch
|
- Remove useless patch
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user