!90 Remove useless patch
Merge pull request !90 from Wenchao Hao/master
This commit is contained in:
commit
720db26e2f
@ -1,119 +0,0 @@
|
||||
From d99f5bb9a8fcd217262d765b096df30724c774e9 Mon Sep 17 00:00:00 2001
|
||||
From: pengyeqing <pengyeqing@huawei.com>
|
||||
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 <pengyeqing@huawei.com>
|
||||
---
|
||||
usr/iscsiadm.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 files changed, 71 insertions(+)
|
||||
|
||||
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
|
||||
index f2bd721..b386abe 100644
|
||||
--- a/usr/iscsiadm.c
|
||||
+++ b/usr/iscsiadm.c
|
||||
@@ -69,6 +69,8 @@ static char program_name[] = "iscsiadm";
|
||||
static char config_file[TARGET_NAME_MAXLEN];
|
||||
extern struct iscsi_ipc *ipc;
|
||||
|
||||
+#define ISCSIPID_LEN 256
|
||||
+
|
||||
enum iscsiadm_mode {
|
||||
MODE_DISCOVERY,
|
||||
MODE_DISCOVERYDB,
|
||||
@@ -267,11 +269,52 @@ str_to_portal_type(char *str)
|
||||
return ptype;
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * get_content() - Utility function to read hex values from sysfs
|
||||
+ * @param pidfile - path to use
|
||||
+ * @parm buf - this is the value returned from the entry
|
||||
+ * @return 0 on success <0 on failure
|
||||
+ * @note: buf[] return without '\0'
|
||||
+ */
|
||||
+static int get_file_content(const char *pidfile, char buf[], int buflen)
|
||||
+{
|
||||
+ int rc = 0;
|
||||
+ FILE *fp = NULL;
|
||||
+ size_t chars_read = 0;
|
||||
+
|
||||
+ fp = fopen(pidfile, "r");
|
||||
+ if (fp == NULL) {
|
||||
+ log_error("Could not open path: %s [%s]",
|
||||
+ pidfile, strerror(errno));
|
||||
+ rc = -EIO;
|
||||
+ goto error_fopen;
|
||||
+ }
|
||||
+
|
||||
+ chars_read = fread(buf, 1, buflen, fp);
|
||||
+ if ((chars_read <= 0) && ferror(fp)) {
|
||||
+ log_error("Could not read from: %s [%s]",
|
||||
+ pidfile, strerror(ferror(fp)));
|
||||
+ rc = -EIO;
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
+error:
|
||||
+ fclose(fp);
|
||||
+
|
||||
+error_fopen:
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
static void kill_iscsid(int priority, int tmo)
|
||||
{
|
||||
iscsiadm_req_t req;
|
||||
iscsiadm_rsp_t rsp;
|
||||
int rc;
|
||||
+ char *pTmp = NULL;
|
||||
+ char iscsidpid[ISCSIPID_LEN] = {0};
|
||||
+ char procpid[ISCSIPID_LEN] = {0};
|
||||
+ char cmdline[ISCSIPID_LEN] = {0};
|
||||
+ char iscsidcmdline[ISCSIPID_LEN] = {0};
|
||||
|
||||
/*
|
||||
* We only support SIGTERM like stoppage of iscsid for now.
|
||||
@@ -287,6 +330,34 @@ static void kill_iscsid(int priority, int tmo)
|
||||
return;
|
||||
}
|
||||
|
||||
+ /* if pid of iscsid is present, go on; or return directly */
|
||||
+ rc = get_file_content(PID_FILE, iscsidpid, ISCSIPID_LEN);
|
||||
+ if (rc != 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ snprintf(procpid, ISCSIPID_LEN, "/proc/%ld/cmdline", atol(iscsidpid));
|
||||
+
|
||||
+ rc = get_file_content(procpid, cmdline, ISCSIPID_LEN);
|
||||
+ if (rc != 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ snprintf(iscsidcmdline, ISCSIPID_LEN, "%s", cmdline);
|
||||
+
|
||||
+ pTmp = strstr(iscsidcmdline, "iscsid");
|
||||
+ if (NULL == pTmp) {
|
||||
+ log_error("iscsid pid mismatch proc cmdline, pid:%ld, cmdline:%s.\n", atol(iscsidpid), iscsidcmdline);
|
||||
+ return;
|
||||
+ } else {
|
||||
+ rc = kill(atol(iscsidpid), 0);
|
||||
+ if (ESRCH == rc) {
|
||||
+ log_error("iscsid %ld maybe in zombie.\n", atol(iscsidpid));
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ /* end */
|
||||
+
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.command = MGMT_IPC_IMMEDIATE_STOP;
|
||||
rc = iscsid_exec_req(&req, &rsp, 0, tmo);
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
Name: open-iscsi
|
||||
Version: 2.1.5
|
||||
Release: 5
|
||||
Release: 6
|
||||
Summary: ISCSI software initiator daemon and utility programs
|
||||
License: GPLv2+ and BSD
|
||||
URL: http://www.open-iscsi.com
|
||||
@ -17,15 +17,14 @@ 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-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
|
||||
patch12: 0012-Remove-iscsid.service-s-dependence-of-iscsi-init.ser.patch
|
||||
patch13: 0013-Remove-session-info-password-print.patch
|
||||
patch14: 0014-Remove-iscsiuio-from-build-and-install-recipe.patch
|
||||
patch15: 0015-Remove-iscsiuio-source-code.patch
|
||||
patch16: 0016-Remove-iscsiuio-from-config-and-service-file.patch
|
||||
patch17: 0017-Remove-iscsi-init.service-from-iscsi-and-iscsid-serv.patch
|
||||
patch9: 0009-fix-iscsiadm-op-new-report-to-cannot-rename-error.patch
|
||||
patch10: 0010-Fix-compiler-error-introduced-with-recent-IPv6-commi.patch
|
||||
patch11: 0011-Remove-iscsid.service-s-dependence-of-iscsi-init.ser.patch
|
||||
patch12: 0012-Remove-session-info-password-print.patch
|
||||
patch13: 0013-Remove-iscsiuio-from-build-and-install-recipe.patch
|
||||
patch14: 0014-Remove-iscsiuio-source-code.patch
|
||||
patch15: 0015-Remove-iscsiuio-from-config-and-service-file.patch
|
||||
patch16: 0016-Remove-iscsi-init.service-from-iscsi-and-iscsid-serv.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
|
||||
@ -152,10 +151,13 @@ fi
|
||||
%{_mandir}/man8/*
|
||||
|
||||
%changelog
|
||||
* Tue Feb 8 2021 haowenchao <haowenchao@huawei.com> - 2.1.5-5
|
||||
* Tue Feb 8 2022 haowenchao <haowenchao@huawei.com> - 2.1.5-6
|
||||
- Remove useless patch
|
||||
|
||||
* Tue Feb 8 2022 haowenchao <haowenchao@huawei.com> - 2.1.5-5
|
||||
- Remove iscsi's dependence of iscsid-init.service
|
||||
|
||||
* Thu Jan 26 2022 haowenchao <haowenchao@huawei.com> - 2.1.5-4
|
||||
* Wed Jan 26 2022 haowenchao <haowenchao@huawei.com> - 2.1.5-4
|
||||
- Remove tool iscsiuio
|
||||
|
||||
* Tue Jan 25 2022 haowenchao <haowenchao@huawei.com> - 2.1.5-3
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user