Fix iscsiadm op new report to can not rename error
Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
This commit is contained in:
parent
67d2780d91
commit
177f8ee7e0
80
0012-fix-iscsiadm-op-new-report-to-cannot-rename-error.patch
Normal file
80
0012-fix-iscsiadm-op-new-report-to-cannot-rename-error.patch
Normal file
@ -0,0 +1,80 @@
|
||||
From 181dbc293bf9d0a0c9674d16db6f7d9b1ed19b49 Mon Sep 17 00:00:00 2001
|
||||
From: wubo <wubo40@huawei.com>
|
||||
Date: Mon, 21 Sep 2020 18:54:38 +0800
|
||||
Subject: [PATCH] Fix iscsiadm op new report to cannort rename error
|
||||
|
||||
Since patched 9009-fix-default-file-corrupt.patch,
|
||||
In order to solve the abnormal power failure during iscsiadm login,
|
||||
the node configuration file is cleared, and the target
|
||||
problem cannot be found after restarting.
|
||||
|
||||
The difference between automatically creating target nodes
|
||||
and the target nodes through the discovery process is not considered.
|
||||
The automatically created taregt node s is an regual file,
|
||||
but a directory through the discovery process.
|
||||
It is incorrect to rename a regual file as a directory
|
||||
|
||||
1) Automatically created
|
||||
# iscsiadm -m node
|
||||
9.84.7.19:3260,4294967295iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.970bb3607d7d
|
||||
|
||||
# ls -l /etc/iscsi/nodes/iqn.2003-01.org.linux-iscsi.localhost.x8664\:sn.970bb3607d7d/
|
||||
total 4
|
||||
-rw-------. 1 root root 2096 Sep 21 22:44 9.84.7.19,3260
|
||||
|
||||
2) Discovery process
|
||||
# iscsiadm -m node
|
||||
9.84.7.19:3260,1iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.970bb3607d7d
|
||||
# ls -l /etc/iscsi/nodes/iqn.2003-01.org.linux-iscsi.localhost.x8664\:sn.970bb3607d7d/
|
||||
total 4
|
||||
drw-------. 2 root root 4096 Sep 21 22:44 9.84.7.19,3260,1
|
||||
|
||||
rec->tpgt == PORTAL_GROUP_TAG_UNKNOWN is automatic mode,
|
||||
rec->tpgt is not PORTAL_GROUP_TAG_UNKNOWN is dicovery mode
|
||||
|
||||
Add to support the Two mode.
|
||||
|
||||
Signed-off-by: Wu Bo <wubo40@huawei>
|
||||
---
|
||||
usr/idbm.c | 17 ++++++++++++++---
|
||||
1 file changed, 14 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/usr/idbm.c b/usr/idbm.c
|
||||
index 74b1dec..50e4d7e 100644
|
||||
--- a/usr/idbm.c
|
||||
+++ b/usr/idbm.c
|
||||
@@ -2097,6 +2097,11 @@ mkdir_portal:
|
||||
rec->name, rec->conn[0].address, rec->conn[0].port, rec->tpgt,
|
||||
rec->iface.name);
|
||||
open_conf:
|
||||
+ if (rec->tpgt == PORTAL_GROUP_TAG_UNKNOWN) {
|
||||
+ snprintf(portal, PATH_MAX, "%s/%s/%s,%d_bak", NODE_CONFIG_DIR,
|
||||
+ rec->name, rec->conn[0].address, rec->conn[0].port);
|
||||
+ }
|
||||
+
|
||||
f = fopen(portal, "w");
|
||||
if (!f) {
|
||||
log_error("Could not open %s: %s", portal, strerror(errno));
|
||||
@@ -2131,10 +2136,16 @@ open_conf:
|
||||
rc = ISCSI_ERR_IDBM;
|
||||
goto free_portal;
|
||||
}
|
||||
+
|
||||
+ if (rec->tpgt == PORTAL_GROUP_TAG_UNKNOWN) {
|
||||
+ snprintf(portalDef, PATH_MAX, "%s/%s/%s,%d", NODE_CONFIG_DIR,
|
||||
+ rec->name, rec->conn[0].address, rec->conn[0].port);
|
||||
+ } else {
|
||||
+ snprintf(portalDef, PATH_MAX, "%s/%s/%s,%d,%d/%s", NODE_CONFIG_DIR,
|
||||
+ rec->name, rec->conn[0].address, rec->conn[0].port, rec->tpgt,
|
||||
+ rec->iface.name);
|
||||
+ }
|
||||
|
||||
- snprintf(portalDef, PATH_MAX, "%s/%s/%s,%d,%d/%s", NODE_CONFIG_DIR,
|
||||
- rec->name, rec->conn[0].address, rec->conn[0].port, rec->tpgt,
|
||||
- rec->iface.name);
|
||||
/* Renaming default_bak->default. */
|
||||
if (rename(portal, portalDef) < 0) {
|
||||
log_error("Cannot rename %s -> %s\n", portal, portalDef);
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
Name: open-iscsi
|
||||
Version: 2.1.3
|
||||
Release: 1
|
||||
Release: 2
|
||||
Summary: ISCSI software initiator daemon and utility programs
|
||||
License: GPLv2+ and BSD
|
||||
URL: http://www.open-iscsi.org
|
||||
@ -20,6 +20,7 @@ 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
|
||||
|
||||
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
|
||||
@ -152,6 +153,9 @@ fi
|
||||
%{_mandir}/man8/*
|
||||
|
||||
%changelog
|
||||
* Mon Feb 22 2021 haowenchao <haowenchao@huawei.com> - 2.1.3-2
|
||||
- Fix iscsiadm op new report to can not rename error
|
||||
|
||||
* Thu Jan 28 2021 haowenchao <haowenchao@huawei.com> - 2.1.3-1
|
||||
- Update open-iscsi version to 2.1.3-1
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user