diff --git a/0003-restart-log-daemon-when-exited-abnormally.patch b/0003-restart-log-daemon-when-exited-abnormally.patch index 6c463de..21b8a00 100644 --- a/0003-restart-log-daemon-when-exited-abnormally.patch +++ b/0003-restart-log-daemon-when-exited-abnormally.patch @@ -64,18 +64,18 @@ index ffd12a3..e810de9 100644 struct signalfd_siginfo si; diff --git a/usr/iscsid.c b/usr/iscsid.c -index 3544870..57b0c85 100644 +index 478c83d..cd6f562 100644 --- a/usr/iscsid.c +++ b/usr/iscsid.c -@@ -61,7 +61,6 @@ struct iscsi_daemon_config daemon_config; +@@ -66,7 +66,6 @@ struct iscsi_daemon_config daemon_config; struct iscsi_daemon_config *dconfig = &daemon_config; static char program_name[] = "iscsid"; -static pid_t log_pid; static gid_t gid; - static int daemonize = 1; + static bool daemonize = true; static int mgmt_ipc_fd; -@@ -306,6 +305,7 @@ static void iscsid_shutdown(void) +@@ -311,6 +310,7 @@ static void iscsid_shutdown(void) log_debug(1, "daemon stopping"); log_close(log_pid); } diff --git a/0008-default-file-zero-after-power-outage.patch b/0008-default-file-zero-after-power-outage.patch index 45454cd..e02b3d3 100644 --- a/0008-default-file-zero-after-power-outage.patch +++ b/0008-default-file-zero-after-power-outage.patch @@ -9,10 +9,10 @@ Subject: [PATCH] fix default file zero after power outage, fsync file 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/usr/idbm.c b/usr/idbm.c -index be5f8f9..d431b00 100644 +index 6bd630f..8a8c3a6 100644 --- a/usr/idbm.c +++ b/usr/idbm.c -@@ -2240,6 +2240,23 @@ open_conf: +@@ -2263,6 +2263,23 @@ open_conf: } idbm_print(IDBM_PRINT_TYPE_NODE, rec, 1, f); @@ -36,7 +36,7 @@ index be5f8f9..d431b00 100644 fclose(f); /* add for default_bak -> default */ -@@ -2455,7 +2472,7 @@ int idbm_add_node(node_rec_t *newrec, discovery_rec_t *drec, int overwrite) +@@ -2478,7 +2495,7 @@ int idbm_add_node(node_rec_t *newrec, discovery_rec_t *drec, int overwrite) goto unlock; } @@ -44,7 +44,7 @@ index be5f8f9..d431b00 100644 + rc = idbm_delete_node(newrec); if (rc) goto unlock; - log_debug(7, "overwriting existing record"); + -- 1.8.3.1 diff --git a/0009-Modify-iscsid.service-to-keep-same-with-previous-ver.patch b/0009-Modify-iscsid.service-to-keep-same-with-previous-ver.patch deleted file mode 100644 index 7bffea1..0000000 --- a/0009-Modify-iscsid.service-to-keep-same-with-previous-ver.patch +++ /dev/null @@ -1,48 +0,0 @@ -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 - -Mainly change is service iscsid work mode is changed from -notify to fork. - -Signed-off-by: Wenchao Hao ---- - 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 648ceea..be51f11 100644 ---- a/etc/systemd/iscsid.service -+++ b/etc/systemd/iscsid.service -@@ -1,18 +1,17 @@ - [Unit] - Description=Open-iSCSI --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 --Wants=remote-fs-pre.target - - [Service] --Type=notify --NotifyAccess=main --ExecStart=/sbin/iscsid -f --KillMode=mixed --Restart=on-failure -+Type=forking -+PIDFile=/run/iscsid.pid -+ExecStart=/sbin/iscsid -+ExecStartPost=/usr/bin/sleep 1 -+ExecStop=/sbin/iscsiadm -k 0 2 -+Restart=always -+RestartSec=2s - - [Install] - WantedBy=multi-user.target --Also=iscsid.socket --- -1.8.3.1 - diff --git a/0011-not-send-stop-message-if-iscsid-absent.patch b/0009-not-send-stop-message-if-iscsid-absent.patch similarity index 100% rename from 0011-not-send-stop-message-if-iscsid-absent.patch rename to 0009-not-send-stop-message-if-iscsid-absent.patch diff --git a/0012-fix-iscsiadm-op-new-report-to-cannot-rename-error.patch b/0010-fix-iscsiadm-op-new-report-to-cannot-rename-error.patch similarity index 100% rename from 0012-fix-iscsiadm-op-new-report-to-cannot-rename-error.patch rename to 0010-fix-iscsiadm-op-new-report-to-cannot-rename-error.patch diff --git a/0010-iscsiadm-fix-infinite-loop-while-recv-returns-0.patch b/0010-iscsiadm-fix-infinite-loop-while-recv-returns-0.patch deleted file mode 100644 index 7f20b91..0000000 --- a/0010-iscsiadm-fix-infinite-loop-while-recv-returns-0.patch +++ /dev/null @@ -1,30 +0,0 @@ -From d91000561f82b5fd73fa22d23232ed99d647b962 Mon Sep 17 00:00:00 2001 -From: Wanlong Gao -Date: Thu, 22 Mar 2018 13:16:47 +0000 -Subject: [PATCH] iscsiadm: fix infinite loop while recv() returns 0 - -[Changelog]: fix infinite loop while recv() returns 0 -[Author]: Jiao Jianbing - -Signed-off-by: Jiao Jianbing -Signed-off-by: Wanlong Gao ---- - usr/iscsid_req.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c -index f0b474f..808d5fe 100644 ---- a/usr/iscsid_req.c -+++ b/usr/iscsid_req.c -@@ -173,7 +173,7 @@ int iscsid_response(int fd, iscsiadm_cmd_e cmd, iscsiadm_rsp_t *rsp, - return ISCSI_ERR_ISCSID_COMM_ERR; - } else if (pfd.revents & POLLIN) { - err = recv(fd, rsp, sizeof(*rsp), MSG_WAITALL); -- if (err < 0) { -+ if (err <= 0) { - log_error("read error (%d/%d), daemon died?", - err, errno); - break; --- -1.8.3.1 - diff --git a/0011-Fix-compiler-error-introduced-with-recent-IPv6-commi.patch b/0011-Fix-compiler-error-introduced-with-recent-IPv6-commi.patch new file mode 100644 index 0000000..859bc0a --- /dev/null +++ b/0011-Fix-compiler-error-introduced-with-recent-IPv6-commi.patch @@ -0,0 +1,38 @@ +From 424d5967e94f6adf4c0669d390779af8da0bef20 Mon Sep 17 00:00:00 2001 +From: Lee Duncan +Date: Sat, 18 Sep 2021 16:10:50 -0700 +Subject: [PATCH] Fix compiler error introduced with recent IPv6 commit. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Commit 76350316de38 ("Handle IPv6 interfaces correctly.") added +a string copy that creates this gcc-11 error message: + +> gcc-11 -O2 -g -Wall -Werror -Wextra -fvisibility=hidden -fPIC -I/usr/include/kmod -c -o idbm.o idbm.c +> idbm.c: In function ‘_idbm_node_rec_link’: +> idbm.c:999:17: error: ‘strncpy’ specified bound 65 equals destination size [-Werror=stringop-truncation] +> 999 | strncpy((*node).iface.name, iface_name, ISCSI_MAX_IFACE_LEN); +> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +So copy one less character, maximum. +--- + libopeniscsiusr/idbm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libopeniscsiusr/idbm.c b/libopeniscsiusr/idbm.c +index b2524ed..6f57e45 100644 +--- a/libopeniscsiusr/idbm.c ++++ b/libopeniscsiusr/idbm.c +@@ -996,7 +996,7 @@ static void _idbm_node_rec_link(struct iscsi_node *node, struct idbm_rec *recs, + + /* use the interface name passed in, if any */ + if (iface_name) +- strncpy((*node).iface.name, iface_name, ISCSI_MAX_IFACE_LEN); ++ strncpy((*node).iface.name, iface_name, ISCSI_MAX_IFACE_LEN-1); + + /* + * Note: because we do not add the iface.iscsi_ifacename to +-- +2.30.0 + diff --git a/0013-iscsiadm-Fix-memory-leak-in-iscsiadm.patch b/0013-iscsiadm-Fix-memory-leak-in-iscsiadm.patch deleted file mode 100644 index a9f75e2..0000000 --- a/0013-iscsiadm-Fix-memory-leak-in-iscsiadm.patch +++ /dev/null @@ -1,160 +0,0 @@ -From b24f8ff48e2285e42d151f73e464531c49a9509e Mon Sep 17 00:00:00 2001 -From: Wenchao Hao -Date: Tue, 29 Dec 2020 20:30:25 +0800 -Subject: [PATCH] iscsiadm: Fix memory leak in iscsiadm - -Memory allocated by iscsi_context_new() would not be freed if -error occurred during parameters parser stage and goto free_ifaces -is used to jump to resource clean. - -Since all resource clean is performed after verified, so change -all goto free_ifaces to goto out where handles resource better. - -Signed-off-by: Wenchao Hao ---- - libopeniscsiusr/context.c | 6 +++++- - usr/iscsiadm.c | 27 +++++++++++++-------------- - 2 files changed, 18 insertions(+), 15 deletions(-) - -diff --git a/libopeniscsiusr/context.c b/libopeniscsiusr/context.c -index fe92155..c5e869f 100644 ---- a/libopeniscsiusr/context.c -+++ b/libopeniscsiusr/context.c -@@ -55,8 +55,12 @@ struct iscsi_context *iscsi_context_new(void) - - void iscsi_context_free(struct iscsi_context *ctx) - { -- if (ctx != NULL) -+ if (ctx == NULL) -+ return; -+ -+ if (ctx->db) - _idbm_free(ctx->db); -+ - free(ctx); - } - -diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c -index ea1643b..3987168 100644 ---- a/usr/iscsiadm.c -+++ b/usr/iscsiadm.c -@@ -3627,7 +3627,7 @@ main(int argc, char **argv) - "Priority must be greater than or " - "equal to zero.", killiscsid); - rc = ISCSI_ERR_INVAL; -- goto free_ifaces; -+ goto out; - } - break; - case 't': -@@ -3639,7 +3639,7 @@ main(int argc, char **argv) - log_error("can not recognize operation: '%s'", - optarg); - rc = ISCSI_ERR_INVAL; -- goto free_ifaces; -+ goto out; - } - break; - case 'n': -@@ -3651,7 +3651,7 @@ main(int argc, char **argv) - case 'H': - host_no = parse_host_info(optarg, &rc); - if (rc) -- goto free_ifaces; -+ goto out; - break; - case 'r': - sid = iscsi_sysfs_get_sid_from_path(optarg); -@@ -3659,7 +3659,7 @@ main(int argc, char **argv) - log_error("invalid sid '%s'", - optarg); - rc = ISCSI_ERR_INVAL; -- goto free_ifaces; -+ goto out; - } - break; - case 'R': -@@ -3710,7 +3710,7 @@ main(int argc, char **argv) - mode = str_to_mode(optarg); - rc = verify_mode_params(argc, argv, mode); - if (ISCSI_SUCCESS != rc) -- goto free_ifaces; -+ goto out; - break; - case 'C': - sub_mode = str_to_submode(optarg); -@@ -3739,11 +3739,11 @@ main(int argc, char **argv) - printf("Invalid iface name %s. Must be from " - "1 to %d characters.\n", - optarg, ISCSI_MAX_IFACE_LEN - 1); -- goto free_ifaces; -+ goto out; - } else if (!iface || rc) { - printf("Could not add iface %s.", optarg); - rc = ISCSI_ERR_INVAL; -- goto free_ifaces; -+ goto out; - } - - list_add_tail(&iface->list, &ifaces); -@@ -3760,7 +3760,7 @@ main(int argc, char **argv) - log_error("Invalid index %s. %s.", - optarg, strerror(errno)); - rc = ISCSI_ERR_INVAL; -- goto free_ifaces; -+ goto out; - } - break; - case 'A': -@@ -3778,7 +3778,7 @@ main(int argc, char **argv) - if (!param) { - log_error("Cannot allocate memory for params."); - rc = ISCSI_ERR_NOMEM; -- goto free_ifaces; -+ goto out; - } - list_add_tail(¶m->list, ¶ms); - name = NULL; -@@ -3789,12 +3789,12 @@ main(int argc, char **argv) - if (optopt) { - log_error("unrecognized character '%c'", optopt); - rc = ISCSI_ERR_INVAL; -- goto free_ifaces; -+ goto out; - } - - if (killiscsid >= 0) { - kill_iscsid(killiscsid, timeout); -- goto free_ifaces; -+ goto out; - } - - if (mode < 0) -@@ -3802,14 +3802,14 @@ main(int argc, char **argv) - - if (mode == MODE_FW) { - rc = exec_fw_op(NULL, NULL, info_level, do_login, op); -- goto free_ifaces; -+ goto out; - } - - increase_max_files(); - if (idbm_init(get_config_file)) { - log_warning("exiting due to idbm configuration error"); - rc = ISCSI_ERR_IDBM; -- goto free_ifaces; -+ goto out; - } - - switch (mode) { -@@ -4070,7 +4070,6 @@ out: - free(rec); - iscsi_sessions_free(ses, se_count); - idbm_terminate(); --free_ifaces: - list_for_each_entry_safe(iface, tmp, &ifaces, list) { - list_del(&iface->list); - free(iface); --- -2.27.0 - diff --git a/0014-Fix-iscsiadm-segfault-when-exiting.patch b/0014-Fix-iscsiadm-segfault-when-exiting.patch deleted file mode 100644 index 544b9c8..0000000 --- a/0014-Fix-iscsiadm-segfault-when-exiting.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 76a5ebf955702f676a5ea5f7b43bb8fb436edc40 Mon Sep 17 00:00:00 2001 -From: Lee Duncan -Date: Tue, 26 Jan 2021 11:48:32 -0800 -Subject: [PATCH] Fix iscsiadm segfault when exiting - -Commit b532ad67d495d added some cleanup code -to iscsiadm right before it exits, but it -used a list_for_each_entry() to iterate through -a list was being deleted, when it should use -list_for_each_entry_safe(). - -Fixes: b532ad67d495d ---- - usr/iscsiadm.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c -index 4249af8..41b7e6f 100644 ---- a/usr/iscsiadm.c -+++ b/usr/iscsiadm.c -@@ -3582,11 +3582,11 @@ main(int argc, char **argv) - struct sigaction sa_old; - struct sigaction sa_new; - LIST_HEAD(ifaces); -- struct iface_rec *iface = NULL, *tmp; -+ struct iface_rec *iface = NULL, *tmp_iface; - struct node_rec *rec = NULL; - uint32_t host_no = MAX_HOST_NO + 1; - uint64_t index = ULLONG_MAX; -- struct user_param *param; -+ struct user_param *param, *tmp_param; - LIST_HEAD(params); - struct iscsi_context *ctx = NULL; - int librc = LIBISCSI_OK; -@@ -4070,11 +4070,11 @@ out: - free(rec); - iscsi_sessions_free(ses, se_count); - idbm_terminate(); -- list_for_each_entry_safe(iface, tmp, &ifaces, list) { -+ list_for_each_entry_safe(iface, tmp_iface, &ifaces, list) { - list_del(&iface->list); - free(iface); - } -- list_for_each_entry(param, ¶ms, list) { -+ list_for_each_entry_safe(param, tmp_param, ¶ms, list) { - list_del(¶m->list); - idbm_free_user_param(param); - } --- -2.27.0 - diff --git a/open-iscsi-2.1.3.tar.gz b/open-iscsi-2.1.3.tar.gz deleted file mode 100644 index 0ea784f..0000000 Binary files a/open-iscsi-2.1.3.tar.gz and /dev/null differ diff --git a/open-iscsi-2.1.5.tar.gz b/open-iscsi-2.1.5.tar.gz new file mode 100644 index 0000000..8b5de0b Binary files /dev/null and b/open-iscsi-2.1.5.tar.gz differ diff --git a/open-iscsi.spec b/open-iscsi.spec index 4608204..aee7838 100644 --- a/open-iscsi.spec +++ b/open-iscsi.spec @@ -3,12 +3,12 @@ %global socket_enable() /bin/systemctl enable %1.socket >/dev/null 2>&1 || : Name: open-iscsi -Version: 2.1.3 -Release: 6 +Version: 2.1.5 +Release: 1 Summary: ISCSI software initiator daemon and utility programs License: GPLv2+ and BSD URL: http://www.open-iscsi.com -Source0: https://github.com/open-iscsi/open-iscsi/archive/2.1.3.tar.gz#/open-iscsi-2.1.3.tar.gz +Source0: https://github.com/open-iscsi/open-iscsi/archive/2.1.5.tar.gz#/open-iscsi-2.1.5.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 @@ -17,12 +17,9 @@ 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 -patch12: 0012-fix-iscsiadm-op-new-report-to-cannot-rename-error.patch -patch13: 0013-iscsiadm-Fix-memory-leak-in-iscsiadm.patch -patch14: 0014-Fix-iscsiadm-segfault-when-exiting.patch +patch9: 0009-not-send-stop-message-if-iscsid-absent.patch +patch10: 0010-fix-iscsiadm-op-new-report-to-cannot-rename-error.patch +patch11: 0011-Fix-compiler-error-introduced-with-recent-IPv6-commi.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 @@ -139,6 +136,8 @@ fi %{_unitdir}/* %{_sbindir}/* %{_libdir}/libopeniscsiusr.so.* +%exclude %{_unitdir}/iscsi-init.service + %dir %{_sysconfdir}/iscsi %attr(0600,root,root) %config(noreplace) %{_sysconfdir}/iscsi/iscsid.conf @@ -155,6 +154,9 @@ fi %{_mandir}/man8/* %changelog +* Tue Nov 16 2021 haowenchao - 2.1.5-1 +- Update open-iscsi version to 2.1.5-1 + * Thu Oct 21 2021 haowenchao - 2.1.3-6 - update upstream URL