diff --git a/0006-restart-log-daemon-when-exited-abnormally.patch b/0003-restart-log-daemon-when-exited-abnormally.patch similarity index 90% rename from 0006-restart-log-daemon-when-exited-abnormally.patch rename to 0003-restart-log-daemon-when-exited-abnormally.patch index 9900913ffc859f2c876ef211db0ea3ffe54aecb3..6c463de67ec3cee24c2cee480ab67162392f6539 100644 --- a/0006-restart-log-daemon-when-exited-abnormally.patch +++ b/0003-restart-log-daemon-when-exited-abnormally.patch @@ -1,17 +1,20 @@ -From 88767cf8e6c62df3260e895664bfe7094e55d565 Mon Sep 17 00:00:00 2001 +From eee26673e0f5da0589d718e986661c878a4747d2 Mon Sep 17 00:00:00 2001 From: wangjufeng Date: Sat, 20 Oct 2018 14:50:28 +0800 Subject: [PATCH] tt + +Conflict: Remove previous patch's unused variable,these unused variable + would cause compile failure --- usr/event_poll.c | 17 +++++++- usr/iscsid.c | 2 +- - usr/log.c | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- + usr/log.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- usr/log.h | 6 +++ - 4 files changed, 144 insertions(+), 5 deletions(-) + 4 files changed, 142 insertions(+), 5 deletions(-) diff --git a/usr/event_poll.c b/usr/event_poll.c -index 4cf4ce2..7b70cb7 100644 +index ffd12a3..e810de9 100644 --- a/usr/event_poll.c +++ b/usr/event_poll.c @@ -151,8 +151,11 @@ void event_loop_exit(queue_task_t *qtask) @@ -61,10 +64,10 @@ index 4cf4ce2..7b70cb7 100644 struct signalfd_siginfo si; diff --git a/usr/iscsid.c b/usr/iscsid.c -index c9ab9eb..56689e5 100644 +index 3544870..57b0c85 100644 --- a/usr/iscsid.c +++ b/usr/iscsid.c -@@ -62,7 +62,6 @@ struct iscsi_daemon_config daemon_config; +@@ -61,7 +61,6 @@ struct iscsi_daemon_config daemon_config; struct iscsi_daemon_config *dconfig = &daemon_config; static char program_name[] = "iscsid"; @@ -72,7 +75,7 @@ index c9ab9eb..56689e5 100644 static gid_t gid; static int daemonize = 1; static int mgmt_ipc_fd; -@@ -307,6 +306,7 @@ static void iscsid_shutdown(void) +@@ -306,6 +305,7 @@ static void iscsid_shutdown(void) log_debug(1, "daemon stopping"); log_close(log_pid); } @@ -81,7 +84,7 @@ index c9ab9eb..56689e5 100644 static void catch_signal(int signo) diff --git a/usr/log.c b/usr/log.c -index 6e16e7c..c225bdc 100644 +index 29cf39f..55c6a08 100644 --- a/usr/log.c +++ b/usr/log.c @@ -18,6 +18,7 @@ @@ -114,7 +117,7 @@ index 6e16e7c..c225bdc 100644 return 0; -@@ -421,6 +430,105 @@ static void __log_close(void) +@@ -421,6 +430,103 @@ static void __log_close(void) } } @@ -161,8 +164,6 @@ index 6e16e7c..c225bdc 100644 +static int log_read_comm_frpm_pid(pid_t pid, char *buffer, int len) +{ + char comm_file[256]; -+ char comm_content[1024]; -+ int r; + FILE *fd = NULL; + buffer[0] = '\0'; + snprintf(comm_file, sizeof(comm_file), "/proc/%i/comm", pid); @@ -220,7 +221,7 @@ index 6e16e7c..c225bdc 100644 int log_init(char *program_name, int size, void (*func)(int prio, void *priv, const char *fmt, va_list ap), void *priv) -@@ -443,6 +551,8 @@ int log_init(char *program_name, int size, +@@ -443,6 +549,8 @@ int log_init(char *program_name, int size, return -1; } @@ -229,7 +230,7 @@ index 6e16e7c..c225bdc 100644 pid = fork(); if (pid < 0) { syslog(LOG_ERR, "starting logger failed"); -@@ -463,6 +573,8 @@ int log_init(char *program_name, int size, +@@ -463,6 +571,8 @@ int log_init(char *program_name, int size, sigaction(SIGTERM, &sa_new, &sa_old ); while(1) { @@ -238,7 +239,7 @@ index 6e16e7c..c225bdc 100644 log_flush(); sleep(1); -@@ -487,7 +599,15 @@ void log_close(pid_t pid) +@@ -487,7 +597,15 @@ void log_close(pid_t pid) } if (pid > 0) { diff --git a/0007-check-initiator-name-out-of-range.patch b/0004-check-initiator-name-out-of-range.patch similarity index 82% rename from 0007-check-initiator-name-out-of-range.patch rename to 0004-check-initiator-name-out-of-range.patch index 917399a19b3b1a3cf274d0f438753246af0c9d5d..18a30b629885604a16dceeab96bf54c2283927d4 100644 --- a/0007-check-initiator-name-out-of-range.patch +++ b/0004-check-initiator-name-out-of-range.patch @@ -5,6 +5,8 @@ Subject: [PATCH] iscsi-initiator-utils: check initiator name out of range reason:check initiator name out of range +Conflict: Fix compile warning which cause compile failure + Signed-off-by: pengyeqing --- usr/mgmt_ipc.c | 9 ++++++++- @@ -21,7 +23,7 @@ index 1ffcda9..ce4defb 100644 - if (dconfig->initiator_name) + if (dconfig->initiator_name) { + if (VALUE_MAXLEN <= strlen(dconfig->initiator_name)){ -+ log_error("iscsid: len[%d] of initiator name out of range, max len %d.", strlen(dconfig->initiator_name), VALUE_MAXLEN-1); ++ log_error("iscsid: len[%ld] of initiator name out of range, max len %d.", strlen(dconfig->initiator_name), VALUE_MAXLEN-1); + return ISCSI_ERR_INVAL; + } + diff --git a/0008-do-not-sync-session-when-a-session-is-already-created.patch b/0005-do-not-sync-session-when-a-session-is-already-created.patch similarity index 100% rename from 0008-do-not-sync-session-when-a-session-is-already-created.patch rename to 0005-do-not-sync-session-when-a-session-is-already-created.patch diff --git a/0005-iscsid-SIGTERM-syncprocess-hang.patch b/0005-iscsid-SIGTERM-syncprocess-hang.patch deleted file mode 100644 index f727aa382da361aa27e6eb5ea53fb2921a32be76..0000000000000000000000000000000000000000 --- a/0005-iscsid-SIGTERM-syncprocess-hang.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 1f4eb61f62a4f4245ddfd61440eb679f65ae8194 Mon Sep 17 00:00:00 2001 -From: pengyeqing -Date: Sat, 26 Jan 2019 23:41:05 +0800 -Subject: [PATCH] iscsi-initiator-utils: iscsid SIGTERM syncprocess hang - -reason:iscsid SIGTERM syncprocess hang - -Signed-off-by: pengyeqing ---- - usr/iscsid.c | 2 ++ - usr/iscsid_req.c | 10 ++++++++++ - usr/iscsid_req.h | 1 + - 3 files changed, 13 insertions(+) - -diff --git a/usr/iscsid.c b/usr/iscsid.c -index b95917d..48d0f52 100644 ---- a/usr/iscsid.c -+++ b/usr/iscsid.c -@@ -39,6 +39,7 @@ - #include "mgmt_ipc.h" - #include "event_poll.h" - #include "iscsi_ipc.h" -+#include "iscsid_req.h" - #include "log.h" - #include "iscsi_util.h" - #include "initiator.h" -@@ -314,6 +315,7 @@ static void catch_signal(int signo) - switch (signo) { - case SIGTERM: - event_loop_exit(NULL); -+ signal_term_in(); - break; - default: - break; -diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c -index d18b14d..76aa035 100644 ---- a/usr/iscsid_req.c -+++ b/usr/iscsid_req.c -@@ -37,6 +37,13 @@ - #include "iscsid_req.h" - #include "uip_mgmt_ipc.h" - -+static int sigterm_in; -+ -+void signal_term_in() -+{ -+ sigterm_in= 1; -+} -+ - static void iscsid_startup(void) - { - char *startup_cmd; -@@ -145,6 +152,9 @@ int iscsid_response(int fd, iscsiadm_cmd_e cmd, iscsiadm_rsp_t *rsp, - while (len) { - struct pollfd pfd; - -+ if (sigterm_in) -+ return ISCSI_ERR_ISCSID_COMM_ERR; -+ - pfd.fd = fd; - pfd.events = POLLIN; - err = poll(&pfd, 1, timeout); -diff --git a/usr/iscsid_req.h b/usr/iscsid_req.h -index d580ed2..6f139a8 100644 ---- a/usr/iscsid_req.h -+++ b/usr/iscsid_req.h -@@ -41,5 +41,6 @@ extern int iscsid_req_by_sid(iscsiadm_cmd_e cmd, int sid); - - extern int uip_broadcast(void *buf, size_t buf_len, int fd_flags, - uint32_t *status); -+extern void signal_term_in(void); - - #endif --- -1.8.3.1 - diff --git a/0009-fix-default-file-corrupt.patch b/0006-fix-default-file-corrupt.patch similarity index 100% rename from 0009-fix-default-file-corrupt.patch rename to 0006-fix-default-file-corrupt.patch diff --git a/0011-fix-iscsiadm-logout-timeout.patch b/0007-fix-iscsiadm-logout-timeout.patch similarity index 71% rename from 0011-fix-iscsiadm-logout-timeout.patch rename to 0007-fix-iscsiadm-logout-timeout.patch index 949f51cc4f2a7e31ecedda47ef19393994a60198..41a7df10ea88549e66fd4311f5a1bbe3ad8d0462 100644 --- a/0011-fix-iscsiadm-logout-timeout.patch +++ b/0007-fix-iscsiadm-logout-timeout.patch @@ -1,20 +1,22 @@ -From 521637e6e1274fbecd8c588681b24f628e2eec97 Mon Sep 17 00:00:00 2001 +From c6fbda57e25c154a6dfbd31e9e2f64b9efb3cc43 Mon Sep 17 00:00:00 2001 From: pengyeqing -Date: Sun, 27 Jan 2019 00:16:18 +0800 +Date: Thu, 28 Jan 2021 15:37:02 +0800 Subject: [PATCH] iscsi-initiator-utils: fix iscsiadm logout timeout reason:fix iscsiadm logout timeout +Conflict: Adapt for open-iscsi-2.1.3 version + Signed-off-by: pengyeqing --- usr/iscsid_req.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c -index 78000f4..18bb9db 100644 +index a3aba6d..ca32298 100644 --- a/usr/iscsid_req.c +++ b/usr/iscsid_req.c -@@ -64,6 +64,7 @@ static void iscsid_startup(void) +@@ -60,6 +60,7 @@ static void iscsid_startup(void) } #define MAXSLEEP 128 @@ -22,7 +24,7 @@ index 78000f4..18bb9db 100644 static int ipc_connect(int *fd, char *unix_sock_name, int start_iscsid) { -@@ -147,7 +148,7 @@ int iscsid_response(int fd, iscsiadm_cmd_e cmd, iscsiadm_rsp_t *rsp, +@@ -145,7 +146,7 @@ int iscsid_response(int fd, iscsiadm_cmd_e cmd, iscsiadm_rsp_t *rsp, if (timeout == -1) { timeout = ISCSID_REQ_TIMEOUT; @@ -31,7 +33,7 @@ index 78000f4..18bb9db 100644 } while (len) { struct pollfd pfd; -@@ -159,8 +160,10 @@ int iscsid_response(int fd, iscsiadm_cmd_e cmd, iscsiadm_rsp_t *rsp, +@@ -154,8 +155,10 @@ int iscsid_response(int fd, iscsiadm_cmd_e cmd, iscsiadm_rsp_t *rsp, pfd.events = POLLIN; err = poll(&pfd, 1, timeout); if (!err) { @@ -40,7 +42,7 @@ index 78000f4..18bb9db 100644 continue; + log_warning("wait %d seconds timeout, try again?", + ISCSID_IPC_WAIT_RESPOND); - return ISCSI_ERR_ISCSID_NOTCONN; + return ISCSI_ERR_SESSION_NOT_CONNECTED; } else if (err < 0) { if (errno == EINTR) -- diff --git a/0012-default-file-zero-after-power-outage.patch b/0008-default-file-zero-after-power-outage.patch similarity index 100% rename from 0012-default-file-zero-after-power-outage.patch rename to 0008-default-file-zero-after-power-outage.patch diff --git a/0003-add-sleep-for-service.patch b/0009-Modify-iscsid.service-to-keep-same-with-previous-ver.patch similarity index 39% rename from 0003-add-sleep-for-service.patch rename to 0009-Modify-iscsid.service-to-keep-same-with-previous-ver.patch index bc26f70b010a74e22c2b209ed7a64e69d7546cb8..7bffea1bbec882f60009a7f49481f0ceec52a103 100644 --- a/0003-add-sleep-for-service.patch +++ b/0009-Modify-iscsid.service-to-keep-same-with-previous-ver.patch @@ -1,28 +1,30 @@ -From 83126f4ab8c67704d779d9d15b2e1227d11209ff Mon Sep 17 00:00:00 2001 -From: pengyeqing -Date: Sat, 26 Jan 2019 22:44:59 +0800 -Subject: [PATCH] iscsi-initiator-utils: add sleep for service +From e357c243e01e1972659db09bda32e8d1e4a04330 Mon Sep 17 00:00:00 2001 +From: Wenchao Hao +Date: Fri, 29 Jan 2021 15:58:40 +0800 +Subject: [PATCH] Modify iscsid.service to keep same with previous version -add sleep for service +Mainly change is service iscsid work mode is changed from +notify to fork. -Signed-off-by: pengyeqing -Signed-off-by: wuguanghao +Signed-off-by: Wenchao Hao --- - etc/systemd/iscsid.service | 15 ++++++--------- - 1 file changed, 6 insertions(+), 9 deletions(-) + etc/systemd/iscsid.service | 19 +++++++++---------- + 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service -index 4fef168..f3f8c65 100644 +index 648ceea..be51f11 100644 --- a/etc/systemd/iscsid.service +++ b/etc/systemd/iscsid.service -@@ -1,17 +1,14 @@ +@@ -1,18 +1,17 @@ [Unit] Description=Open-iSCSI - Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8) --DefaultDependencies=no +-Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8) ++Documentation=man:iscsid(8) man:iscsiadm(8) ++After=network.target + DefaultDependencies=no -After=network.target iscsiuio.service -Before=remote-fs-pre.target -+After=network.target NetworkManager-wait-online.service iscsiuio.service tgtd.service targetcli.service +-Wants=remote-fs-pre.target [Service] -Type=notify @@ -31,10 +33,12 @@ index 4fef168..f3f8c65 100644 -KillMode=mixed -Restart=on-failure +Type=forking -+PIDFile=/var/run/iscsid.pid ++PIDFile=/run/iscsid.pid +ExecStart=/sbin/iscsid -+ExecStopPost=/usr/bin/sleep 1 ++ExecStartPost=/usr/bin/sleep 1 +ExecStop=/sbin/iscsiadm -k 0 2 ++Restart=always ++RestartSec=2s [Install] WantedBy=multi-user.target diff --git a/0004-not-send-stop-message-if-iscsid-absent.patch b/0011-not-send-stop-message-if-iscsid-absent.patch similarity index 84% rename from 0004-not-send-stop-message-if-iscsid-absent.patch rename to 0011-not-send-stop-message-if-iscsid-absent.patch index da09de5f8472b2614b10b744ad86a18b413c2948..3cafba0645c3fb09345cdc4816bd2b91b9bfdf7f 100644 --- a/0004-not-send-stop-message-if-iscsid-absent.patch +++ b/0011-not-send-stop-message-if-iscsid-absent.patch @@ -3,25 +3,16 @@ From: pengyeqing Date: Mon, 20 Jan 2020 19:43:52 +0800 Subject: [PATCH] iscsi-initiator-utils: not send stop message if iscsid absent +Conflict: 1. Remove modification about iscsid.service, these modification are + in 0009-Modify-iscsid.service-to-keep-same-with-previous-ver.patch + 2. change log_error("iscsid %d maybe ...) to + log_error("iscsid %ld maybe ...) to avoid compile failure + Signed-off-by: pengyeqing --- - etc/systemd/iscsid.service | 2 ++ usr/iscsiadm.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 73 insertions(+) + 1 files changed, 71 insertions(+) -diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service -index f3f8c65..2cce190 100644 ---- a/etc/systemd/iscsid.service -+++ b/etc/systemd/iscsid.service -@@ -9,6 +9,8 @@ PIDFile=/var/run/iscsid.pid - ExecStart=/sbin/iscsid - ExecStopPost=/usr/bin/sleep 1 - ExecStop=/sbin/iscsiadm -k 0 2 -+Restart=always -+RestartSec=2s - - [Install] - WantedBy=multi-user.target diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c index f2bd721..b386abe 100644 --- a/usr/iscsiadm.c @@ -114,7 +105,7 @@ index f2bd721..b386abe 100644 + } else { + rc = kill(atol(iscsidpid), 0); + if (ESRCH == rc) { -+ log_error("iscsid %d maybe in zombie.\n", atol(iscsidpid)); ++ log_error("iscsid %ld maybe in zombie.\n", atol(iscsidpid)); + return; + } + } diff --git a/0013-Fix-issue-where-iscsi-iname-p-core-dumps.patch b/0013-Fix-issue-where-iscsi-iname-p-core-dumps.patch deleted file mode 100644 index c9dfc45be7b5a875335e99450b54483719b90f3e..0000000000000000000000000000000000000000 --- a/0013-Fix-issue-where-iscsi-iname-p-core-dumps.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 40454759ba37c69c59473d63635cfccc7bb5ec8d Mon Sep 17 00:00:00 2001 -From: Lee Duncan -Date: Tue, 12 May 2020 16:01:50 +0800 -Subject: [PATCH] Fix issue where 'iscsi-iname -p' core dumps - -Fix issue where 'iscsi-iname -p' core dumps - -Signed-off-by: Lee Duncan ---- - utils/iscsi-iname.c | 17 +++++++++++++---- - 1 file changed, 13 insertions(+), 4 deletions(-) - -diff --git a/utils/iscsi-iname.c b/utils/iscsi-iname.c -index da850dc..d1c067b 100644 ---- a/utils/iscsi-iname.c -+++ b/utils/iscsi-iname.c -@@ -40,6 +40,13 @@ - * a seperator and 12 characters (6 random bytes in hex representation) */ - #define PREFIX_MAX_LEN 210 - -+static void usage(void) -+{ -+ fprintf(stderr, "Usage: iscsi-iname [-h | --help | -p ]\n"); -+ fprintf(stderr, "where has max length of %d\n", -+ PREFIX_MAX_LEN); -+} -+ - int - main(int argc, char *argv[]) - { -@@ -68,15 +75,17 @@ main(int argc, char *argv[]) - "on every invocation.\n"); - exit(0); - } else if ( strcmp(prefix, "-p") == 0 ) { -+ if (argc != 3){ -+ usage(); -+ exit(1); -+ } - prefix = argv[2]; - if (strnlen(prefix, PREFIX_MAX_LEN + 1) > PREFIX_MAX_LEN) { -- printf("Error: Prefix cannot exceed %d " -- "characters.\n", PREFIX_MAX_LEN); -+ usage(); - exit(1); - } - } else { -- printf("\nUsage: iscsi-iname [-h | --help | " -- "-p ]\n"); -+ usage(); - exit(0); - } - } else { --- -1.8.3.1 - diff --git a/0014-modify-iSCSI-shared-memory-permissions-for-logs.patch b/0014-modify-iSCSI-shared-memory-permissions-for-logs.patch deleted file mode 100644 index 4f5967f1895edebf43b249d7033496a4a8c86a3b..0000000000000000000000000000000000000000 --- a/0014-modify-iSCSI-shared-memory-permissions-for-logs.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 3948dec9e2bd50ee3eec9e2288635362eddce171 Mon Sep 17 00:00:00 2001 -From: Wu Bo -Date: Tue, 12 May 2020 16:07:43 +0800 -Subject: [PATCH] modify iSCSI shared memory permissions for logs - -iscsid log damon is responsible for reading data from shared memory -and writing syslog. iscsid is the root group. Currently, it is not -seen that non-root users need to read logs. The priciple of minimizing -the use of permisssions, all the permissions are changed from 644 to 600. - -Signed-off-by: Wu Bo ---- - usr/log.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/usr/log.c b/usr/log.c -index b5c1bdd..2f60bf2 100644 ---- a/usr/log.c -+++ b/usr/log.c -@@ -80,7 +80,7 @@ static int logarea_init (int size) - logdbg(stderr,"enter logarea_init\n"); - - if ((shmid = shmget(IPC_PRIVATE, sizeof(struct logarea), -- 0644 | IPC_CREAT | IPC_EXCL)) == -1) { -+ 0600 | IPC_CREAT | IPC_EXCL)) == -1) { - syslog(LOG_ERR, "shmget logarea failed %d", errno); - return 1; - } -@@ -100,7 +100,7 @@ static int logarea_init (int size) - size = DEFAULT_AREA_SIZE; - - if ((shmid = shmget(IPC_PRIVATE, size, -- 0644 | IPC_CREAT | IPC_EXCL)) == -1) { -+ 0600 | IPC_CREAT | IPC_EXCL)) == -1) { - syslog(LOG_ERR, "shmget msg failed %d", errno); - free_logarea(); - return 1; -@@ -121,7 +121,7 @@ static int logarea_init (int size) - la->tail = la->start; - - if ((shmid = shmget(IPC_PRIVATE, MAX_MSG_SIZE + sizeof(struct logmsg), -- 0644 | IPC_CREAT | IPC_EXCL)) == -1) { -+ 0600 | IPC_CREAT | IPC_EXCL)) == -1) { - syslog(LOG_ERR, "shmget logmsg failed %d", errno); - free_logarea(); - return 1; --- -1.8.3.1 - diff --git a/0015-iscsi-Add-break-to-while-loop.patch b/0015-iscsi-Add-break-to-while-loop.patch deleted file mode 100644 index 98a48ac4efa8987e071d7c428950047579c5316c..0000000000000000000000000000000000000000 --- a/0015-iscsi-Add-break-to-while-loop.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 05766f1e85ea7fbf975559d27814c769328c72dd Mon Sep 17 00:00:00 2001 -From: liubo -Date: Thu, 4 Jun 2020 16:57:07 +0800 -Subject: [PATCH] iscsi: Add break to while loop - -Fix the potential risk of rc value being washed out by jumping out of the loop - -Source Link: https://github.com/open-iscsi/open-iscsi/pull/211 - -Signed-off-by: liubo -Reported-by: Zhiqiang Liu ---- - utils/fwparam_ibft/fwparam_sysfs.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/utils/fwparam_ibft/fwparam_sysfs.c b/utils/fwparam_ibft/fwparam_sysfs.c -index a0cd1c7..87fd6d4 100644 ---- a/utils/fwparam_ibft/fwparam_sysfs.c -+++ b/utils/fwparam_ibft/fwparam_sysfs.c -@@ -115,8 +115,11 @@ static int get_iface_from_device(char *id, struct boot_context *context) - break; - } - -- if (sscanf(dent->d_name, "net:%s", context->iface) != 1) -+ if (sscanf(dent->d_name, "net:%s", context->iface) != 1) { - rc = EINVAL; -+ break; -+ } -+ - rc = 0; - break; - } else { --- -2.21.1 (Apple Git-122.3) - diff --git a/0016-iscsi-fix-fd-leak.patch b/0016-iscsi-fix-fd-leak.patch deleted file mode 100644 index 9befe8b61666152c2005788a5c581d57be58ce18..0000000000000000000000000000000000000000 --- a/0016-iscsi-fix-fd-leak.patch +++ /dev/null @@ -1,33 +0,0 @@ -From e5c4073ae836cd049a4bc3d6c1291a25f88ad67d Mon Sep 17 00:00:00 2001 -From: lixiaokeng -Date: Thu, 4 Jun 2020 20:35:18 +0800 -Subject: [PATCH] iscsi: fix fd leak - -iscsi-review/utils/fwparam_ibft/fwparam_ibft.c: line 466 - -Before return -1, the fd was opend and not closed which would lead -to leak fd. Fix that. - -Source Link: https://github.com/open-iscsi/open-iscsi/pull/212 - -Signed-off-by: lixiaokeng -Reported-by: Zhiqiang Liu ---- - utils/fwparam_ibft/fwparam_ibft.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/utils/fwparam_ibft/fwparam_ibft.c b/utils/fwparam_ibft/fwparam_ibft.c -index 52edac1..e68e503 100644 ---- a/utils/fwparam_ibft/fwparam_ibft.c -+++ b/utils/fwparam_ibft/fwparam_ibft.c -@@ -463,6 +463,7 @@ fwparam_ibft(struct boot_context *context, const char *filepath) - if (stat(filename, &buf)!=0) { - fprintf(stderr, "Could not stat file %s: %s (%d)\n", - filename, strerror(errno), errno); -+ close(fd); - return -1; - } - /* And if not zero use that size */ --- -2.21.1 (Apple Git-122.3) - diff --git a/0017-Fix-devel-without-node-header-files.patch b/0017-Fix-devel-without-node-header-files.patch deleted file mode 100644 index 03b2e4eb40d77b2909c4cc3250e0818470e84a12..0000000000000000000000000000000000000000 --- a/0017-Fix-devel-without-node-header-files.patch +++ /dev/null @@ -1,36 +0,0 @@ -From f01725cfd9b2214f7c602bd72a5af9578dc9d023 Mon Sep 17 00:00:00 2001 -From: si-gui <245140120@qq.com> -Date: Mon, 15 Jun 2020 17:07:36 +0800 -Subject: [PATCH] Fix devel without node header files - -When user include libopeniscsiusr.h in the c files,we will get an error: -"/usr/include/libopeniscsiusr.h:33:10: fatal error: -libopeniscsiusr_node.h: No such file or directory" - -We find libopeniscsiusr_node.h was forgetton in our -libopeniscsiusr/Makefile, so fix it. Otherwise user can't use open-iscsi -header file for development - -Signed-off-by: si-gui <245140120@qq.com> - ---- - libopeniscsiusr/Makefile | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/libopeniscsiusr/Makefile b/libopeniscsiusr/Makefile -index bf7c96c..75f6fb3 100644 ---- a/libopeniscsiusr/Makefile -+++ b/libopeniscsiusr/Makefile -@@ -35,7 +35,8 @@ PKGFILE = libopeniscsiusr.pc - HEADERS = libopeniscsiusr/libopeniscsiusr.h \ - libopeniscsiusr/libopeniscsiusr_common.h \ - libopeniscsiusr/libopeniscsiusr_session.h \ -- libopeniscsiusr/libopeniscsiusr_iface.h -+ libopeniscsiusr/libopeniscsiusr_iface.h \ -+ libopeniscsiusr/libopeniscsiusr_node.h - TESTS = tests/test_context tests/test_session tests/test_iface tests/test_node - EXTRA_MAN_FILES = libopeniscsiusr.h.3 - --- -2.23.0 - diff --git a/0018-resolve-compilation-errors.patch b/0018-resolve-compilation-errors.patch deleted file mode 100644 index 9cfecefb1d2bbc811b076a4003cf084c8a8cc17f..0000000000000000000000000000000000000000 --- a/0018-resolve-compilation-errors.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 982eb357f12b86152f85fb5a1dba47e965ebf9d5 Mon Sep 17 00:00:00 2001 -From: wuguanghao -Date: Thu, 9 Jul 2020 14:56:28 +0800 -Subject: [PATCH] resolve compilation errors - ---- - usr/iscsiadm.c | 2 +- - usr/log.c | 2 -- - usr/mgmt_ipc.c | 2 +- - 3 files changed, 2 insertions(+), 4 deletions(-) - -diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c -index b386abe..ae560bc 100644 ---- a/usr/iscsiadm.c -+++ b/usr/iscsiadm.c -@@ -352,7 +352,7 @@ static void kill_iscsid(int priority, int tmo) - } else { - rc = kill(atol(iscsidpid), 0); - if (ESRCH == rc) { -- log_error("iscsid %d maybe in zombie.\n", atol(iscsidpid)); -+ log_error("iscsid %ld maybe in zombie.\n", atol(iscsidpid)); - return; - } - } -diff --git a/usr/log.c b/usr/log.c -index 3a52263..00a28f1 100644 ---- a/usr/log.c -+++ b/usr/log.c -@@ -473,8 +473,6 @@ static int log_watchdog_setup(void) - static int log_read_comm_frpm_pid(pid_t pid, char *buffer, int len) - { - char comm_file[256]; -- char comm_content[1024]; -- int r; - FILE *fd = NULL; - buffer[0] = '\0'; - snprintf(comm_file, sizeof(comm_file), "/proc/%i/comm", pid); -diff --git a/usr/mgmt_ipc.c b/usr/mgmt_ipc.c -index 3b01949..9e8a323 100644 ---- a/usr/mgmt_ipc.c -+++ b/usr/mgmt_ipc.c -@@ -170,7 +170,7 @@ mgmt_ipc_cfg_initiatorname(queue_task_t *qtask) - { - if (dconfig->initiator_name) { - if (VALUE_MAXLEN <= strlen(dconfig->initiator_name)){ -- log_error("iscsid: len[%d] of initiator name out of range, max len %d.", strlen(dconfig->initiator_name), VALUE_MAXLEN-1); -+ log_error("iscsid: len[%ld] of initiator name out of range, max len %d.", strlen(dconfig->initiator_name), VALUE_MAXLEN-1); - return ISCSI_ERR_INVAL; - } - --- -1.8.3.1 - diff --git a/0019-Update-systemd-unit-files-for-iscsid.patch b/0019-Update-systemd-unit-files-for-iscsid.patch deleted file mode 100644 index 3f0f65c60dbaa148a5264f93226adee749dd7e84..0000000000000000000000000000000000000000 --- a/0019-Update-systemd-unit-files-for-iscsid.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 53034c2ae6d1e4ec659dbace9da02ee8bc48a352 Mon Sep 17 00:00:00 2001 -From: wuguanghao -Date: Tue, 1 Sep 2020 15:39:46 +0800 -Subject: [PATCH] Update systemd unit files for iscsid - -Update systemd unit files for iscsid - -Signed-off-by: Lee Duncan -Signed-off-by: wuguanghao ---- - etc/systemd/iscsid.service | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service -index 2cce190..828877f 100644 ---- a/etc/systemd/iscsid.service -+++ b/etc/systemd/iscsid.service -@@ -1,7 +1,8 @@ - [Unit] - Description=Open-iSCSI --Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8) --After=network.target NetworkManager-wait-online.service iscsiuio.service tgtd.service targetcli.service -+Documentation=man:iscsid(8) man:iscsiadm(8) -+After=network.target -+DefaultDependencies=no - - [Service] - Type=forking --- -1.8.3.1 - diff --git a/0020-Fix-iscsi.service-so-it-handles-restarts-better.patch b/0020-Fix-iscsi.service-so-it-handles-restarts-better.patch deleted file mode 100644 index 62fae4e21bd3f930f46ec8ec5b0c50c965773abb..0000000000000000000000000000000000000000 --- a/0020-Fix-iscsi.service-so-it-handles-restarts-better.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 6a9b0728c55b8ad5c6d5dba3f38697eded09538a Mon Sep 17 00:00:00 2001 -From: Lee Duncan -Date: Wed, 4 Mar 2020 12:59:10 -0800 -Subject: [PATCH 151/170] Fix iscsi.service so it handles restarts better - -Requiring iscsid.service means that a restart of iscsi.service -restarted iscsid.service when unneccesary. - -Also, we should treat an exit value of 15 as normal, since -this just means the session is already present. -It should rely on iscsid.socket, no iscsid.service. ---- - etc/systemd/iscsi.service | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service -index e475888..1c286d1 100644 ---- a/etc/systemd/iscsi.service -+++ b/etc/systemd/iscsi.service -@@ -3,7 +3,7 @@ Description=Login and scanning of iSCSI devices - Documentation=man:iscsiadm(8) man:iscsid(8) - Before=remote-fs.target - After=network.target network-online.target iscsid.service --Requires=iscsid.service -+Requires=iscsid.socket - ConditionPathExists=/etc/iscsi/initiatorname.iscsi - - [Service] -@@ -11,7 +11,7 @@ Type=oneshot - ExecStart=/sbin/iscsiadm -m node --loginall=automatic - ExecStop=/sbin/iscsiadm -m node --logoutall=automatic - ExecStop=/sbin/iscsiadm -m node --logoutall=manual --SuccessExitStatus=21 -+SuccessExitStatus=21 15 - RemainAfterExit=true - - [Install] --- -2.21.1 (Apple Git-122.3) - diff --git a/0021-Ignore-iface.example-in-iface-match-checks.patch b/0021-Ignore-iface.example-in-iface-match-checks.patch deleted file mode 100644 index b8464b4ceb662fffcc91a08671faa732fa4ad4fa..0000000000000000000000000000000000000000 --- a/0021-Ignore-iface.example-in-iface-match-checks.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 16d4899d52b3b88774ac6d9b3cc0f5626f4705da Mon Sep 17 00:00:00 2001 -From: Lee Duncan -Date: Tue, 19 Nov 2019 07:54:41 -0800 -Subject: [PATCH 158/170] Ignore iface.example in iface match checks - -Just a cleanup, as looking at the example file -didn't hurt anything, but did waste our time. ---- - usr/iface.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/usr/iface.c b/usr/iface.c -index 323f167..11f3d2a 100644 ---- a/usr/iface.c -+++ b/usr/iface.c -@@ -905,6 +905,9 @@ int iface_for_each_iface(void *data, int skip_def, int *nr_found, - !strcmp(iface_dent->d_name, "..")) - continue; - -+ if (!strcmp(iface_dent->d_name, "iface.example")) -+ continue; -+ - log_debug(5, "iface_for_each_iface found %s", - iface_dent->d_name); - iface = iface_alloc(iface_dent->d_name, &err); --- -2.21.1 (Apple Git-122.3) - diff --git a/0022-Fix-SIGPIPE-loop-in-signal-handler.patch b/0022-Fix-SIGPIPE-loop-in-signal-handler.patch deleted file mode 100644 index c16c70f12f1f34be6e71922d67062a5368cafc68..0000000000000000000000000000000000000000 --- a/0022-Fix-SIGPIPE-loop-in-signal-handler.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 71e4ce5e7722dde25751025cac0e8b29d8d540df Mon Sep 17 00:00:00 2001 -From: fredvx <48496214+fredvx@users.noreply.github.com> -Date: Wed, 22 Apr 2020 14:24:50 -0400 -Subject: [PATCH 161/170] Fix SIGPIPE loop in signal handler - ---- - usr/iscsid.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/usr/iscsid.c b/usr/iscsid.c -index 99d27ab..e501498 100644 ---- a/usr/iscsid.c -+++ b/usr/iscsid.c -@@ -310,7 +310,12 @@ static void iscsid_shutdown(void) - - static void catch_signal(int signo) - { -- log_debug(1, "pid %d caught signal %d", getpid(), signo); -+ /* -+ * Do not try to call log_debug() if there is a PIPE error -+ * because we can get caught in a PIPE error loop. -+ */ -+ if (signo != SIGPIPE) -+ log_debug(1, "pid %d caught signal %d", getpid(), signo); - - /* In foreground mode, treat SIGINT like SIGTERM */ - if (!daemonize && signo == SIGINT) --- -2.21.1 (Apple Git-122.3) - diff --git a/0023-Proper-disconnect-of-TCP-connection.patch b/0023-Proper-disconnect-of-TCP-connection.patch deleted file mode 100644 index 37a4518fbf7e1e8e0302547dca0ec34624b05ec4..0000000000000000000000000000000000000000 --- a/0023-Proper-disconnect-of-TCP-connection.patch +++ /dev/null @@ -1,55 +0,0 @@ -From dc7560d404857c0540caed2f71f8e7c2e7307ab3 Mon Sep 17 00:00:00 2001 -From: gulams <64251312+gulams@users.noreply.github.com> -Date: Tue, 28 Apr 2020 13:03:50 +0530 -Subject: [PATCH 162/170] Proper disconnect of TCP connection - -1. Due to configuration issues, the logins from iSCSI initiator were getting rejected by the target -2. The initiator was retrying the login again and again -3. Each time the initiator tries to log in, the host number gets incremented by 1 -4. At one point of time, the host number reached 65535 -5. During the login process, once the TCP connection is established, the initiator tries to set the host parameters for the network interface if its not the default interface -6. While setting these host parameters, it will try to do a lookup of the host based upon the host number -7. The host number in "iscsi_uevent" structure is uint32_t. This is given as an argument to the scsi_host_lookup() function -8. This scsi_host_lookup() function takes it as unsigned short. So, when it receives the host number above 65535, the value is wrapped and starts from 0 again -9. Thus the incorrect value of host number is received by the scsi_host_lookup() function and hence it returns with error that the host is not existing in the list -10. Due to this "host not found error", the open-iscsi will retry this particular connection again and again -11. In this each retry, it will disconnect and then connect again with the same connection pointer, i.e it re-opens the connection multiple times till 120 seconds timeout -12. During these 120 seconds, observed that its trying to re-open the connection aroung 400+ times with each time disconnect and connect -13. After 120 seconds, the connection and session will be destroyed -14. So, while doing multiple retries of connect and disconnect during the 120 seconds, when the connect is successful it will try to bind the connection to the session -15. When it binds the connection and session, the reference count for the socket is incremented -16. When it disconnects, its trying to close the socket with close(sockfd) system call -17. This close() system call is entering into the kernel and NOT going forward till the networking layrer to call tcp_close() to send the FIN packet to the target -18. Its not going till tcp_close() because the reference count of the socket is still 1 -19. So, the initiator is not sending the FIN packet to target and hence target is timing out and sending FIN after its timeout. This happens for all the retries (400+) -20. At some point, when this FIN packet is received by the initiator, the connection was destroyed and the memory was re-used for some other purpose and hence we see the panic - -Fix: -== -Fix is to decrement the reference count of the socket fd after disconnect by calling the stop connection - -Corrected the indentation for the change in the function iscsi_login_eh() ---- - usr/initiator.c | 6 +----- - 1 file changed, 1 insertion(+), 5 deletions(-) - -diff --git a/usr/initiator.c b/usr/initiator.c -index a07f9aa..5f4bdca 100644 ---- a/usr/initiator.c -+++ b/usr/initiator.c -@@ -711,11 +711,7 @@ static void iscsi_login_eh(struct iscsi_conn *conn, struct queue_task *qtask, - !iscsi_retry_initial_login(conn)) - session_conn_shutdown(conn, qtask, err); - else { -- session->reopen_cnt++; -- session->t->template->ep_disconnect(conn); -- if (iscsi_conn_connect(conn, qtask)) -- queue_delayed_reopen(qtask, -- ISCSI_CONN_ERR_REOPEN_DELAY); -+ session_conn_reopen(conn, qtask, STOP_CONN_TERM); - } - break; - case R_STAGE_SESSION_REDIRECT: --- -2.21.1 (Apple Git-122.3) - diff --git a/0024-Add-iscsi-init.service.patch b/0024-Add-iscsi-init.service.patch deleted file mode 100644 index bda53b1207c54ae2e41a163d12e95d7d6f368b49..0000000000000000000000000000000000000000 --- a/0024-Add-iscsi-init.service.patch +++ /dev/null @@ -1,52 +0,0 @@ -From f37d5b653f9f251845db3f29b1a3dcb90ec89731 Mon Sep 17 00:00:00 2001 -From: Christian Glombek -Date: Wed, 6 May 2020 02:08:59 +0200 -Subject: [PATCH 163/170] Add iscsi-init.service - -Per Fedora Packaging Guidelines [1], initial configuration of a service -should happen in a one-off init service in order to ensure idempotency, -and not in the %post directive of the RPM spec. - -Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1493296 - -[1]: https://docs.fedoraproject.org/en-US/packaging-guidelines/Initial_Service_Setup/ ---- - etc/systemd/iscsi-init.service | 8 ++++++++ - etc/systemd/iscsi.service | 6 +++--- - 2 files changed, 11 insertions(+), 3 deletions(-) - create mode 100644 etc/systemd/iscsi-init.service - -diff --git a/etc/systemd/iscsi-init.service b/etc/systemd/iscsi-init.service -new file mode 100644 -index 0000000..e058ff0 ---- /dev/null -+++ b/etc/systemd/iscsi-init.service -@@ -0,0 +1,8 @@ -+[Unit] -+Description=One time configuration for iscsi.service -+ConditionPathExists=!/etc/iscsi/initiatorname.iscsi -+ -+[Service] -+Type=oneshot -+RemainAfterExit=no -+ExecStart=/usr/bin/sh -c 'echo "InitiatorName=`/usr/sbin/iscsi-iname`" > /etc/iscsi/initiatorname.iscsi' -diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service -index 1c286d1..2f2bf81 100644 ---- a/etc/systemd/iscsi.service -+++ b/etc/systemd/iscsi.service -@@ -2,9 +2,9 @@ - Description=Login and scanning of iSCSI devices - Documentation=man:iscsiadm(8) man:iscsid(8) - Before=remote-fs.target --After=network.target network-online.target iscsid.service --Requires=iscsid.socket --ConditionPathExists=/etc/iscsi/initiatorname.iscsi -+After=network.target network-online.target -+After=iscsid.service iscsi-init.service -+Requires=iscsid.socket iscsi-init.service - - [Service] - Type=oneshot --- -2.21.1 (Apple Git-122.3) - diff --git a/0025-Fix-issue-with-zero-length-arrays-at-end-of-struct.patch b/0025-Fix-issue-with-zero-length-arrays-at-end-of-struct.patch deleted file mode 100644 index 44bf39c566f8cd2a9cf9ff41ed9e00f1690ca3f7..0000000000000000000000000000000000000000 --- a/0025-Fix-issue-with-zero-length-arrays-at-end-of-struct.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 8d96cc47381a840e5e03384e8077ad238fd1adc4 Mon Sep 17 00:00:00 2001 -From: Lee Duncan -Date: Wed, 3 Jun 2020 08:29:39 -0700 -Subject: [PATCH 164/170] Fix issue with zero-length arrays at end of struct -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -A common practice in C coding, over the years, has been to -add a zero-length array at the end of the structure when trying -to represent a possibly-empty array of bytes that may be -appended to the struct. But the gcc-10 compiler does not -like such structures, taking the zero-length literally. - -The following errors are fixed by this commit: - -> iscsiadm.c: In function ‘session_stats’: -> iscsiadm.c:939:56: error: array subscript ‘() + -1’ is outside the bounds of an interior zero-length array ‘struct iscsi_stats_custom[0]’ [-Werror=zero-length-bounds] -> 939 | (unsigned long long)rsp.u.getstats.stats.custom[i].value); -> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ -> In file included from initiator.h:29, -> from iscsiadm.c:36: -> ../include/iscsi_if.h:844:28: note: while referencing ‘custom’ -> 844 | struct iscsi_stats_custom custom[0] -> | ^~~~~~ -> iscsiadm.c:938:56: error: array subscript ‘() + -1’ is outside the bounds of an interior zero-length array ‘struct iscsi_stats_custom[0]’ [-Werror=zero-length-bounds] -> 938 | printf("\t%s: %llu\n", rsp.u.getstats.stats.custom[i].desc, -> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ -> In file included from initiator.h:29, -> from iscsiadm.c:36: -> ../include/iscsi_if.h:844:28: note: while referencing ‘custom’ -> 844 | struct iscsi_stats_custom custom[0] -> | ^~~~~~ -> cc1: all warnings being treated as errors - -The work around is to convert the two "custom[0]" structure members to -use "custom[]". ---- - include/iscsi_if.h | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/include/iscsi_if.h b/include/iscsi_if.h -index 2d46214..5a1c614 100644 ---- a/include/iscsi_if.h -+++ b/include/iscsi_if.h -@@ -841,7 +841,7 @@ struct iscsi_stats { - * up to ISCSI_STATS_CUSTOM_MAX - */ - uint32_t custom_length; -- struct iscsi_stats_custom custom[0] -+ struct iscsi_stats_custom custom[] - __attribute__ ((aligned (sizeof(uint64_t)))); - }; - -@@ -972,7 +972,7 @@ struct iscsi_offload_host_stats { - * up to ISCSI_HOST_STATS_CUSTOM_MAX - */ - uint32_t custom_length; -- struct iscsi_host_stats_custom custom[0] -+ struct iscsi_host_stats_custom custom[] - __attribute__ ((aligned (sizeof(uint64_t)))); - }; - --- -2.21.1 (Apple Git-122.3) - diff --git a/0026-Fix-a-compiler-complaint-about-writing-one-byte.patch b/0026-Fix-a-compiler-complaint-about-writing-one-byte.patch deleted file mode 100644 index f4216e078e668a5ad35f991fe58433ad9c3e1aa5..0000000000000000000000000000000000000000 --- a/0026-Fix-a-compiler-complaint-about-writing-one-byte.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 10009f1c5fc01238be976867bc02be046325850b Mon Sep 17 00:00:00 2001 -From: Lee Duncan -Date: Wed, 3 Jun 2020 08:36:45 -0700 -Subject: [PATCH 165/170] Fix a compiler complaint about writing one byte - -When playing with IPv6 IP addresses, which are described -in C using a union, and the gcc-10 compiler didn't like -that we were not specifying which member of the union -we wanted to address of, when in fact all members have -the same address. The fix is to be more explicit. ---- - iscsiuio/src/uip/ipv6.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/iscsiuio/src/uip/ipv6.c b/iscsiuio/src/uip/ipv6.c -index 05efa73..11cb4e9 100644 ---- a/iscsiuio/src/uip/ipv6.c -+++ b/iscsiuio/src/uip/ipv6.c -@@ -519,7 +519,7 @@ static void ipv6_insert_protocol_chksum(struct ipv6_hdr *ipv6) - * SRC IP, DST IP, Protocol Data Length, and Next Header. - */ - sum = 0; -- ptr = (u16_t *)&ipv6->ipv6_src; -+ ptr = (u16_t *)&ipv6->ipv6_src.addr16[0]; - - for (i = 0; i < sizeof(struct ipv6_addr); i++) { - sum += HOST_TO_NET16(*ptr); --- -2.21.1 (Apple Git-122.3) - diff --git a/0027-iscsid-Check-Invalid-Session-id-for-stop-connection.patch b/0027-iscsid-Check-Invalid-Session-id-for-stop-connection.patch deleted file mode 100644 index e6d5cbb29d45843e877928a879b4563a49c1cc61..0000000000000000000000000000000000000000 --- a/0027-iscsid-Check-Invalid-Session-id-for-stop-connection.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 9ac758cc472d991d7eaa9a1da17279cbbdbc7ebf Mon Sep 17 00:00:00 2001 -From: gulams <64251312+gulams@users.noreply.github.com> -Date: Thu, 3 Sep 2020 21:28:52 +0530 -Subject: [PATCH 5/8] iscsid: Check Invalid Session id for stop connection - -Description: -If the initiator is rebooting then after the reboot, it will try to -resync (recreate) the existing the connections by reading the sysfs. -While initiator is doing this, i.e when the initiator tries to connect -to the target but if the target service is not yet started, then the -initiator connection will fail. The session id is also not yet assigned -and it will be at its initial value 0xFFFFFFFF which is invalid. The -session id is assigned a valid value only after a successful connection. -Since the connection is failed, the initiator code will queue the -connection for re-open. The connection state is still at -ISCSI_CONN_STATE_XPT_WAIT as its very first login attemp after the -reboot. -Due to my Pull #206 request the code will invoke the stop connection to -decrement the socket_fd reference count to properly close the connecion -(details are in pull request #206). But since the session id is not -valid, the stop connection will fail and the code will go ahead and -queue the re-open without attempting the connect again. This is repeated -till 120 seconds (stop connection failing and requeuing the reopen -without invoking connect) and the connection will be shutdown resulting -the storage unavailable. - -Fix: -We need to check the validity of the session id before calling the stop -connection. If the session id is valid then only invoke the stop -connection. Due to this, the code will go ahead and attempt the connet -call. If the target service comes up anytime in 120 seconds, then the -connect will be successful and we will get connected to the target. ---- - usr/initiator.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/usr/initiator.c b/usr/initiator.c -index 5f4bdca..684647c 100644 ---- a/usr/initiator.c -+++ b/usr/initiator.c -@@ -692,6 +692,7 @@ static void iscsi_login_eh(struct iscsi_conn *conn, struct queue_task *qtask, - int err) - { - struct iscsi_session *session = conn->session; -+ int stop_flag = 0; - - log_debug(3, "iscsi_login_eh"); - /* -@@ -711,7 +712,11 @@ static void iscsi_login_eh(struct iscsi_conn *conn, struct queue_task *qtask, - !iscsi_retry_initial_login(conn)) - session_conn_shutdown(conn, qtask, err); - else { -- session_conn_reopen(conn, qtask, STOP_CONN_TERM); -+ stop_flag = (session->id < INVALID_SESSION_ID) ? STOP_CONN_TERM : 0; -+ log_debug(6, "connection %p socket_fd: %d, " -+ "session id: %d stop_flag: %d\n", -+ conn, conn->socket_fd, session->id, stop_flag); -+ session_conn_reopen(conn, qtask, stop_flag); - } - break; - case R_STAGE_SESSION_REDIRECT: --- -1.8.3.1 - diff --git a/0028-iscsiadm-buffer-overflow-regression-when-discovering.patch b/0028-iscsiadm-buffer-overflow-regression-when-discovering.patch deleted file mode 100644 index c2411565e19b2d09ba2244f82ffc948aed23b712..0000000000000000000000000000000000000000 --- a/0028-iscsiadm-buffer-overflow-regression-when-discovering.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0c032f5f4f826199868099f0af10c4a913209573 Mon Sep 17 00:00:00 2001 -From: Chris Leech -Date: Mon, 14 Sep 2020 14:09:56 -0700 -Subject: [PATCH 6/8] iscsiadm buffer overflow regression when discovering many - targets at once - -int_list type didn't zero the output string, so as the rec struct was reused -repeatedly during discovery it would keep growing with repeated values -triggering a strcat buffer overflow ---- - usr/idbm.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/usr/idbm.c b/usr/idbm.c -index 6309be0..42c2699 100644 ---- a/usr/idbm.c -+++ b/usr/idbm.c -@@ -169,6 +169,7 @@ static struct idbm *db; - #define __recinfo_int_list(_key,_info,_rec,_name,_show,_tbl,_n,_mod) do { \ - _info[_n].type = TYPE_INT_LIST; \ - strlcpy(_info[_n].name, _key, NAME_MAXVAL); \ -+ _info[_n].value[0] = '\0'; \ - for (unsigned long _i = 0; _i < ARRAY_LEN(_rec->_name); _i++) { \ - if (_rec->_name[_i] != (unsigned)~0) { \ - for (unsigned long _j = 0; _j < ARRAY_LEN(_tbl); _j++) { \ --- -1.8.3.1 - diff --git a/0029-iscsid-Change-iscsid-service-PIDFile-to-run-iscsid.i.patch b/0029-iscsid-Change-iscsid-service-PIDFile-to-run-iscsid.i.patch deleted file mode 100644 index 543e5cb09dc23ad34e14aa4306d366af528ced89..0000000000000000000000000000000000000000 --- a/0029-iscsid-Change-iscsid-service-PIDFile-to-run-iscsid.i.patch +++ /dev/null @@ -1,29 +0,0 @@ -From dafbd11b65b2bbceed1e9b72d6213ddea73a0a34 Mon Sep 17 00:00:00 2001 -From: Wenchao Hao -Date: Sat, 12 Dec 2020 17:09:34 +0800 -Subject: [PATCH] iscsid: Change iscsid service PIDFile to /run/iscsid.ipd - -The pid file has be changed from /var/run/iscsid.pid to -/run/iscsid.pid in code, here perform a sync. - -Signed-off-by: Wenchao Hao ---- - etc/systemd/iscsid.service | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service -index 828877f..be3ae9e 100644 ---- a/etc/systemd/iscsid.service -+++ b/etc/systemd/iscsid.service -@@ -6,7 +6,7 @@ DefaultDependencies=no - - [Service] - Type=forking --PIDFile=/var/run/iscsid.pid -+PIDFile=/run/iscsid.pid - ExecStart=/sbin/iscsid - ExecStopPost=/usr/bin/sleep 1 - ExecStop=/sbin/iscsiadm -k 0 2 --- -2.29.2.435.g72ffeb997e - diff --git a/open-iscsi-2.1.1.tar.gz b/open-iscsi-2.1.1.tar.gz deleted file mode 100644 index 38bb58f6210147254ee812cc57e3dbf9c5174e93..0000000000000000000000000000000000000000 Binary files a/open-iscsi-2.1.1.tar.gz and /dev/null differ diff --git a/open-iscsi-2.1.3.tar.gz b/open-iscsi-2.1.3.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..0ea784f6c93bd9f0f70b50cfff7d3b3f71d04d92 Binary files /dev/null and b/open-iscsi-2.1.3.tar.gz differ diff --git a/open-iscsi.spec b/open-iscsi.spec index 2df6a81c436e34b5986d928e83eee83849584d61..b3dc1486a3d82b93b6f9566205a13d73fc3cc814 100644 --- a/open-iscsi.spec +++ b/open-iscsi.spec @@ -3,41 +3,23 @@ %global socket_enable() /bin/systemctl enable %1.socket >/dev/null 2>&1 || : Name: open-iscsi -Version: 2.1.1 -Release: 5 +Version: 2.1.3 +Release: 1 Summary: ISCSI software initiator daemon and utility programs License: GPLv2+ and BSD URL: http://www.open-iscsi.org -Source0: https://github.com/open-iscsi/open-iscsi/archive/2.1.1.tar.gz#/open-iscsi-2.1.1.tar.gz -Patch1: 0001-change-iscsi-iqn-default-value.patch -Patch2: 0002-iscsid-Check-nr_sessions-when-creating-a-copy-of-exi.patch -Patch3: 0003-add-sleep-for-service.patch -Patch4: 0004-not-send-stop-message-if-iscsid-absent.patch -Patch5: 0005-iscsid-SIGTERM-syncprocess-hang.patch -Patch6: 0006-restart-log-daemon-when-exited-abnormally.patch -Patch7: 0007-check-initiator-name-out-of-range.patch -Patch8: 0008-do-not-sync-session-when-a-session-is-already-created.patch -Patch9: 0009-fix-default-file-corrupt.patch -Patch10: 0010-iscsiadm-fix-infinite-loop-while-recv-returns-0.patch -Patch11: 0011-fix-iscsiadm-logout-timeout.patch -Patch12: 0012-default-file-zero-after-power-outage.patch -Patch13: 0013-Fix-issue-where-iscsi-iname-p-core-dumps.patch -Patch14: 0014-modify-iSCSI-shared-memory-permissions-for-logs.patch -Patch15: 0015-iscsi-Add-break-to-while-loop.patch -Patch16: 0016-iscsi-fix-fd-leak.patch -Patch17: 0017-Fix-devel-without-node-header-files.patch -Patch18: 0018-resolve-compilation-errors.patch -Patch19: 0019-Update-systemd-unit-files-for-iscsid.patch -Patch20: 0020-Fix-iscsi.service-so-it-handles-restarts-better.patch -Patch21: 0021-Ignore-iface.example-in-iface-match-checks.patch -Patch22: 0022-Fix-SIGPIPE-loop-in-signal-handler.patch -Patch23: 0023-Proper-disconnect-of-TCP-connection.patch -Patch24: 0024-Add-iscsi-init.service.patch -Patch25: 0025-Fix-issue-with-zero-length-arrays-at-end-of-struct.patch -Patch26: 0026-Fix-a-compiler-complaint-about-writing-one-byte.patch -Patch27: 0027-iscsid-Check-Invalid-Session-id-for-stop-connection.patch -Patch28: 0028-iscsiadm-buffer-overflow-regression-when-discovering.patch -Patch29: 0029-iscsid-Change-iscsid-service-PIDFile-to-run-iscsid.i.patch +Source0: https://github.com/open-iscsi/open-iscsi/archive/2.1.3.tar.gz#/open-iscsi-2.1.3.tar.gz +patch1: 0001-change-iscsi-iqn-default-value.patch +patch2: 0002-iscsid-Check-nr_sessions-when-creating-a-copy-of-exi.patch +patch3: 0003-restart-log-daemon-when-exited-abnormally.patch +patch4: 0004-check-initiator-name-out-of-range.patch +patch5: 0005-do-not-sync-session-when-a-session-is-already-created.patch +patch6: 0006-fix-default-file-corrupt.patch +patch7: 0007-fix-iscsiadm-logout-timeout.patch +patch8: 0008-default-file-zero-after-power-outage.patch +patch9: 0009-Modify-iscsid.service-to-keep-same-with-previous-ver.patch +patch10: 0010-iscsiadm-fix-infinite-loop-while-recv-returns-0.patch +patch11: 0011-not-send-stop-message-if-iscsid-absent.patch 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 gdb @@ -88,7 +70,7 @@ Requires: man This contains man files for the using of %{name}. %prep -%autosetup -n open-iscsi-2.1.1 -p1 +%autosetup -n %{name}-%{version} -p1 perl -i -pe 's|^exec_prefix = /$|exec_prefix = %{_exec_prefix}|' Makefile %build @@ -170,6 +152,9 @@ fi %{_mandir}/man8/* %changelog +* Thu Jan 28 2021 haowenchao - 2.1.3-1 +- Update open-iscsi version to 2.1.3-1 + * Sat Dec 12 2020 haowenchao - 2.1.1-5 - Change iscsid service PIDFile to /run/iscsid.ipd The pid file has be changed from /var/run/iscsid.pid to