basebuilder_pel7ppc64bebuilder0
7 years ago
52 changed files with 143876 additions and 0 deletions
@ -0,0 +1,55 @@
@@ -0,0 +1,55 @@
|
||||
From 24a4d8156786dfd91dcc17b2472653e963ebd028 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Tue, 13 Aug 2013 10:59:44 -0700 |
||||
Subject: idmb_rec_write, check for tpgt first |
||||
|
||||
Factor out the check for a tpgt to a single place, before going crazy on |
||||
the rec files. Makes flow of this function easier to follow, and preps |
||||
for splitting it up. |
||||
--- |
||||
usr/idbm.c | 18 +++++------------- |
||||
1 file changed, 5 insertions(+), 13 deletions(-) |
||||
|
||||
diff --git a/usr/idbm.c b/usr/idbm.c |
||||
index 1e4f8c8..0a88699 100644 |
||||
--- a/usr/idbm.c |
||||
+++ b/usr/idbm.c |
||||
@@ -1849,6 +1849,10 @@ static int idbm_rec_write(node_rec_t *rec) |
||||
if (rc) |
||||
goto free_portal; |
||||
|
||||
+ if (rec->tpgt == PORTAL_GROUP_TAG_UNKNOWN) |
||||
+ /* drop down to old style portal as config */ |
||||
+ goto open_conf; |
||||
+ |
||||
rc = stat(portal, &statb); |
||||
if (rc) { |
||||
rc = 0; |
||||
@@ -1857,23 +1861,11 @@ static int idbm_rec_write(node_rec_t *rec) |
||||
* set the tgpt. In new versions you must pass all the info in |
||||
* from the start |
||||
*/ |
||||
- if (rec->tpgt == PORTAL_GROUP_TAG_UNKNOWN) |
||||
- /* drop down to old style portal as config */ |
||||
- goto open_conf; |
||||
- else |
||||
- goto mkdir_portal; |
||||
+ goto mkdir_portal; |
||||
} |
||||
|
||||
if (!S_ISDIR(statb.st_mode)) { |
||||
/* |
||||
- * older iscsiadm versions had you create the config then set |
||||
- * set the tgpt. In new versions you must pass all the info in |
||||
- * from the start |
||||
- */ |
||||
- if (rec->tpgt == PORTAL_GROUP_TAG_UNKNOWN) |
||||
- /* drop down to old style portal as config */ |
||||
- goto open_conf; |
||||
- /* |
||||
* Old style portal as a file, but with tpgt. Let's update it. |
||||
*/ |
||||
if (unlink(portal)) { |
||||
-- |
||||
1.8.1.4 |
||||
|
@ -0,0 +1,180 @@
@@ -0,0 +1,180 @@
|
||||
From 220f360b81246a45d6246b85f7b6bf4133f3c213 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Tue, 13 Aug 2013 11:34:31 -0700 |
||||
Subject: [PATCH] idbm_rec_write, seperate old and new style writes |
||||
|
||||
Duplicates a small bit of code, but easier to understand and extened. |
||||
--- |
||||
usr/idbm.c | 116 +++++++++++++++++++++++++++++++++++++++++-------------------- |
||||
1 file changed, 79 insertions(+), 37 deletions(-) |
||||
|
||||
diff --git a/usr/idbm.c b/usr/idbm.c |
||||
index caec94f..2b4f0da 100644 |
||||
--- a/usr/idbm.c |
||||
+++ b/usr/idbm.c |
||||
@@ -2000,7 +2000,7 @@ mkdir_portal: |
||||
return f; |
||||
} |
||||
|
||||
-static int idbm_rec_write(node_rec_t *rec) |
||||
+static int idbm_rec_write_new(node_rec_t *rec) |
||||
{ |
||||
struct stat statb; |
||||
FILE *f; |
||||
@@ -2012,38 +2012,8 @@ static int idbm_rec_write(node_rec_t *rec) |
||||
log_error("Could not alloc portal"); |
||||
return ISCSI_ERR_NOMEM; |
||||
} |
||||
- |
||||
- snprintf(portal, PATH_MAX, "%s", NODE_CONFIG_DIR); |
||||
- if (access(portal, F_OK) != 0) { |
||||
- if (mkdir(portal, 0660) != 0) { |
||||
- log_error("Could not make %s: %s", portal, |
||||
- strerror(errno)); |
||||
- rc = ISCSI_ERR_IDBM; |
||||
- goto free_portal; |
||||
- } |
||||
- } |
||||
- |
||||
- snprintf(portal, PATH_MAX, "%s/%s", NODE_CONFIG_DIR, rec->name); |
||||
- if (access(portal, F_OK) != 0) { |
||||
- if (mkdir(portal, 0660) != 0) { |
||||
- log_error("Could not make %s: %s", portal, |
||||
- strerror(errno)); |
||||
- rc = ISCSI_ERR_IDBM; |
||||
- goto free_portal; |
||||
- } |
||||
- } |
||||
- |
||||
snprintf(portal, PATH_MAX, "%s/%s/%s,%d", NODE_CONFIG_DIR, |
||||
rec->name, rec->conn[0].address, rec->conn[0].port); |
||||
- log_debug(5, "Looking for config file %s", portal); |
||||
- |
||||
- rc = idbm_lock(); |
||||
- if (rc) |
||||
- goto free_portal; |
||||
- |
||||
- if (rec->tpgt == PORTAL_GROUP_TAG_UNKNOWN) |
||||
- /* drop down to old style portal as config */ |
||||
- goto open_conf; |
||||
|
||||
rc = stat(portal, &statb); |
||||
if (rc) { |
||||
@@ -2064,11 +2034,11 @@ static int idbm_rec_write(node_rec_t *rec) |
||||
log_error("Could not convert %s: %s", portal, |
||||
strerror(errno)); |
||||
rc = ISCSI_ERR_IDBM; |
||||
- goto unlock; |
||||
+ goto free_portal; |
||||
} |
||||
} else { |
||||
rc = ISCSI_ERR_INVAL; |
||||
- goto unlock; |
||||
+ goto free_portal; |
||||
} |
||||
|
||||
mkdir_portal: |
||||
@@ -2079,24 +2049,96 @@ mkdir_portal: |
||||
log_error("Could not make dir %s: %s", |
||||
portal, strerror(errno)); |
||||
rc = ISCSI_ERR_IDBM; |
||||
- goto unlock; |
||||
+ goto free_portal; |
||||
} |
||||
} |
||||
|
||||
snprintf(portal, 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); |
||||
-open_conf: |
||||
+/* open_conf: */ |
||||
f = fopen(portal, "w"); |
||||
if (!f) { |
||||
log_error("Could not open %s: %s", portal, strerror(errno)); |
||||
rc = ISCSI_ERR_IDBM; |
||||
- goto unlock; |
||||
+ goto free_portal; |
||||
} |
||||
|
||||
idbm_print(IDBM_PRINT_TYPE_NODE, rec, 1, f); |
||||
fclose(f); |
||||
-unlock: |
||||
+free_portal: |
||||
+ free(portal); |
||||
+ return rc; |
||||
+} |
||||
+ |
||||
+static int idbm_rec_write_old(node_rec_t *rec) |
||||
+{ |
||||
+ FILE *f; |
||||
+ char *portal; |
||||
+ int rc = 0; |
||||
+ |
||||
+ portal = malloc(PATH_MAX); |
||||
+ if (!portal) { |
||||
+ log_error("Could not alloc portal"); |
||||
+ return ISCSI_ERR_NOMEM; |
||||
+ } |
||||
+ snprintf(portal, PATH_MAX, "%s/%s/%s,%d", 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)); |
||||
+ rc = ISCSI_ERR_IDBM; |
||||
+ goto free_portal; |
||||
+ } |
||||
+ idbm_print(IDBM_PRINT_TYPE_NODE, rec, 1, f); |
||||
+ fclose(f); |
||||
+free_portal: |
||||
+ free(portal); |
||||
+ return rc; |
||||
+} |
||||
+ |
||||
+static int idbm_rec_write(node_rec_t *rec) |
||||
+{ |
||||
+ char *portal; |
||||
+ int rc = 0; |
||||
+ |
||||
+ portal = malloc(PATH_MAX); |
||||
+ if (!portal) { |
||||
+ log_error("Could not alloc portal"); |
||||
+ return ISCSI_ERR_NOMEM; |
||||
+ } |
||||
+ |
||||
+ snprintf(portal, PATH_MAX, "%s", NODE_CONFIG_DIR); |
||||
+ if (access(portal, F_OK) != 0) { |
||||
+ if (mkdir(portal, 0660) != 0) { |
||||
+ log_error("Could not make %s: %s", portal, |
||||
+ strerror(errno)); |
||||
+ rc = ISCSI_ERR_IDBM; |
||||
+ goto free_portal; |
||||
+ } |
||||
+ } |
||||
+ |
||||
+ snprintf(portal, PATH_MAX, "%s/%s", NODE_CONFIG_DIR, rec->name); |
||||
+ if (access(portal, F_OK) != 0) { |
||||
+ if (mkdir(portal, 0660) != 0) { |
||||
+ log_error("Could not make %s: %s", portal, |
||||
+ strerror(errno)); |
||||
+ rc = ISCSI_ERR_IDBM; |
||||
+ goto free_portal; |
||||
+ } |
||||
+ } |
||||
+ |
||||
+ rc = idbm_lock(); |
||||
+ if (rc) |
||||
+ goto free_portal; |
||||
+ |
||||
+ if (rec->tpgt == PORTAL_GROUP_TAG_UNKNOWN) |
||||
+ /* old style portal as config */ |
||||
+ rc = idbm_rec_write_old(rec); |
||||
+ else |
||||
+ rc = idbm_rec_write_new(rec); |
||||
+ |
||||
idbm_unlock(); |
||||
free_portal: |
||||
free(portal); |
||||
-- |
||||
2.5.5 |
||||
|
@ -0,0 +1,87 @@
@@ -0,0 +1,87 @@
|
||||
From 69de52494cd8f57762ca9b0b7811929f7f9b4287 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Tue, 13 Aug 2013 12:39:07 -0700 |
||||
Subject: [PATCH] idbw_rec_write, pick tpgt from existing record |
||||
|
||||
On a static add (-m node -o new) without a user specified tpgt, looks |
||||
for existing new style records with tpgt before creating an old style |
||||
record without. If one exists, take the tpgt from it an write an |
||||
updated new style record instead. |
||||
--- |
||||
usr/idbm.c | 40 ++++++++++++++++++++++++++++++++++++++++ |
||||
1 file changed, 40 insertions(+) |
||||
|
||||
diff --git a/usr/idbm.c b/usr/idbm.c |
||||
index 2b4f0da..a2ad57f 100644 |
||||
--- a/usr/idbm.c |
||||
+++ b/usr/idbm.c |
||||
@@ -27,6 +27,7 @@ |
||||
#include <errno.h> |
||||
#include <dirent.h> |
||||
#include <limits.h> |
||||
+#include <glob.h> |
||||
#include <sys/stat.h> |
||||
#include <sys/file.h> |
||||
|
||||
@@ -162,6 +163,8 @@ static struct idbm *db; |
||||
_n++; \ |
||||
} while(0) |
||||
|
||||
+static int idbm_remove_disc_to_node_link(node_rec_t *rec, char *portal); |
||||
+ |
||||
static void |
||||
idbm_recinfo_discovery(discovery_rec_t *r, recinfo_t *ri) |
||||
{ |
||||
@@ -2076,12 +2079,49 @@ static int idbm_rec_write_old(node_rec_t *rec) |
||||
FILE *f; |
||||
char *portal; |
||||
int rc = 0; |
||||
+ glob_t globbuf; |
||||
+ int i; |
||||
+ int tpgt = PORTAL_GROUP_TAG_UNKNOWN; |
||||
|
||||
portal = malloc(PATH_MAX); |
||||
if (!portal) { |
||||
log_error("Could not alloc portal"); |
||||
return ISCSI_ERR_NOMEM; |
||||
} |
||||
+ |
||||
+ /* check for newer portal dir with tpgt */ |
||||
+ snprintf(portal, PATH_MAX, "%s/%s/%s,%d,*", NODE_CONFIG_DIR, |
||||
+ rec->name, rec->conn[0].address, rec->conn[0].port); |
||||
+ rc = glob(portal, GLOB_ONLYDIR, NULL, &globbuf); |
||||
+ if (!rc) { |
||||
+ if (globbuf.gl_pathc > 1) |
||||
+ log_warning("multiple tpg records for portal " |
||||
+ "%s/%s:%d found", rec->name, |
||||
+ rec->conn[0].address, rec->conn[0].port); |
||||
+ /* set pattern for sscanf matching of tpgt */ |
||||
+ snprintf(portal, PATH_MAX, "%s/%s/%s,%d,%%u", NODE_CONFIG_DIR, |
||||
+ rec->name, rec->conn[0].address, rec->conn[0].port); |
||||
+ for (i = 0; i < globbuf.gl_pathc; i++) { |
||||
+ rc = sscanf(globbuf.gl_pathv[i], portal, &tpgt); |
||||
+ if (rc == 1) |
||||
+ break; |
||||
+ } |
||||
+ if (tpgt == PORTAL_GROUP_TAG_UNKNOWN) |
||||
+ log_warning("glob match on existing records, " |
||||
+ "but no valid tpgt found"); |
||||
+ } |
||||
+ globfree(&globbuf); |
||||
+ rc = 0; |
||||
+ |
||||
+ /* if a tpgt was selected from an old record, write entry in new format */ |
||||
+ if (tpgt != PORTAL_GROUP_TAG_UNKNOWN) { |
||||
+ log_warning("using tpgt %u from existing record", tpgt); |
||||
+ rec->tpgt = tpgt; |
||||
+ rc = idbm_remove_disc_to_node_link(rec, portal); |
||||
+ free(portal); |
||||
+ return idbm_rec_write_new(rec); |
||||
+ } |
||||
+ |
||||
snprintf(portal, PATH_MAX, "%s/%s/%s,%d", NODE_CONFIG_DIR, |
||||
rec->name, rec->conn[0].address, rec->conn[0].port); |
||||
|
||||
-- |
||||
2.5.5 |
||||
|
@ -0,0 +1,93 @@
@@ -0,0 +1,93 @@
|
||||
From 1c3b1d23e0b3f17399ffd4463cafad813b0444d5 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Wed, 19 Dec 2012 15:07:36 -0800 |
||||
Subject: update systemd service files, add iscsi.service for starting |
||||
sessions on boot |
||||
|
||||
Signed-off-by: Chris Leech <cleech@redhat.com> |
||||
--- |
||||
etc/systemd/iscsi.service | 19 +++++++++++++++++++ |
||||
etc/systemd/iscsi_mark_root_nodes | 14 ++++++++++++++ |
||||
etc/systemd/iscsid.service | 7 +++++-- |
||||
etc/systemd/iscsid.socket | 2 +- |
||||
4 files changed, 39 insertions(+), 3 deletions(-) |
||||
create mode 100644 etc/systemd/iscsi.service |
||||
create mode 100755 etc/systemd/iscsi_mark_root_nodes |
||||
|
||||
diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service |
||||
new file mode 100644 |
||||
index 0000000..bbd52fd |
||||
--- /dev/null |
||||
+++ b/etc/systemd/iscsi.service |
||||
@@ -0,0 +1,19 @@ |
||||
+[Unit] |
||||
+Description=Login and scanning of iSCSI devices |
||||
+Documentation=man:iscsid(8) man:iscsiadm(8) |
||||
+DefaultDependencies=no |
||||
+Conflicts=shutdown.target |
||||
+After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service |
||||
+Before=remote-fs-pre.target |
||||
+ConditionPathExists=/etc/iscsi/initiatorname.iscsi |
||||
+ |
||||
+[Service] |
||||
+Type=oneshot |
||||
+RemainAfterExit=true |
||||
+ExecStart=/usr/libexec/iscsi_mark_root_nodes |
||||
+ExecStart=/sbin/iscsiadm -m node --loginall=automatic |
||||
+ExecStop=/bin/sync |
||||
+ExecStop=/sbin/iscsiadm -m node --logoutall=automatic |
||||
+ |
||||
+[Install] |
||||
+WantedBy=sysinit.target |
||||
diff --git a/etc/systemd/iscsi_mark_root_nodes b/etc/systemd/iscsi_mark_root_nodes |
||||
new file mode 100755 |
||||
index 0000000..c68475c |
||||
--- /dev/null |
||||
+++ b/etc/systemd/iscsi_mark_root_nodes |
||||
@@ -0,0 +1,14 @@ |
||||
+#!/bin/bash |
||||
+ |
||||
+ISCSIADM=/sbin/iscsiadm |
||||
+SESSION_FILE=/run/initramfs/iscsi.sessions |
||||
+ |
||||
+if [ ! -f $SESSION_FILE ] ; then |
||||
+ exit 0 |
||||
+fi |
||||
+ |
||||
+while read t num i target; do |
||||
+ ip=${i%:*} |
||||
+ $ISCSIADM -m node -p $ip -T $target -o update -n node.startup -v onboot |
||||
+done < $SESSION_FILE |
||||
+ |
||||
diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service |
||||
index 028e0b3..653dd08 100644 |
||||
--- a/etc/systemd/iscsid.service |
||||
+++ b/etc/systemd/iscsid.service |
||||
@@ -1,7 +1,10 @@ |
||||
[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) |
||||
+DefaultDependencies=no |
||||
+Conflicts=shutdown.target |
||||
+After=network.target iscsiuio.service |
||||
+Before=remote-fs-pre.target |
||||
|
||||
[Service] |
||||
Type=forking |
||||
diff --git a/etc/systemd/iscsid.socket b/etc/systemd/iscsid.socket |
||||
index 832451d..58a8d12 100644 |
||||
--- a/etc/systemd/iscsid.socket |
||||
+++ b/etc/systemd/iscsid.socket |
||||
@@ -1,6 +1,6 @@ |
||||
[Unit] |
||||
Description=Open-iSCSI iscsid Socket |
||||
-Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8) |
||||
+Documentation=man:iscsid(8) man:iscsiadm(8) |
||||
|
||||
[Socket] |
||||
ListenStream=@ISCSIADM_ABSTRACT_NAMESPACE |
||||
-- |
||||
1.7.11.7 |
||||
|
@ -0,0 +1,75 @@
@@ -0,0 +1,75 @@
|
||||
From 8f79529354b4023c371e00091f11bdd523497639 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Mon, 19 Aug 2013 07:18:25 -0700 |
||||
Subject: iscsi boot related service file updates |
||||
|
||||
make sure iscsid gets started if there are any boot sessions running |
||||
add reload target to fix double session problem when restarting from NM |
||||
don't rely on session list passed from initrd, never got fully implemented |
||||
--- |
||||
etc/systemd/iscsi-mark-root-nodes | 13 +++++++++++++ |
||||
etc/systemd/iscsi.service | 3 ++- |
||||
etc/systemd/iscsi_mark_root_nodes | 14 -------------- |
||||
3 files changed, 15 insertions(+), 15 deletions(-) |
||||
create mode 100644 etc/systemd/iscsi-mark-root-nodes |
||||
delete mode 100644 etc/systemd/iscsi_mark_root_nodes |
||||
|
||||
diff --git a/etc/systemd/iscsi-mark-root-nodes b/etc/systemd/iscsi-mark-root-nodes |
||||
new file mode 100644 |
||||
index 0000000..157be62 |
||||
--- /dev/null |
||||
+++ b/etc/systemd/iscsi-mark-root-nodes |
||||
@@ -0,0 +1,13 @@ |
||||
+#!/bin/bash |
||||
+ |
||||
+ISCSIADM=/sbin/iscsiadm |
||||
+ |
||||
+$ISCSIADM -m session >/dev/null 2>&1 || exit 0 |
||||
+ |
||||
+$ISCSIADM -m session | while read t num i target; do |
||||
+ ip=${i%:*} |
||||
+ $ISCSIADM -m node -p $ip -T $target -o update -n node.startup -v onboot |
||||
+done |
||||
+ |
||||
+systemctl start iscsid.service |
||||
+ |
||||
diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service |
||||
index 7b4efee..d5712bd 100644 |
||||
--- a/etc/systemd/iscsi.service |
||||
+++ b/etc/systemd/iscsi.service |
||||
@@ -10,10 +10,11 @@ ConditionDirectoryNotEmpty=/var/lib/iscsi/nodes |
||||
[Service] |
||||
Type=oneshot |
||||
RemainAfterExit=true |
||||
-ExecStart=/usr/libexec/iscsi_mark_root_nodes |
||||
+ExecStart=/usr/libexec/iscsi-mark-root-nodes |
||||
ExecStart=/sbin/iscsiadm -m node --loginall=automatic |
||||
ExecStop=/bin/sync |
||||
ExecStop=/sbin/iscsiadm -m node --logoutall=automatic |
||||
+ExecReload=/sbin/iscsiadm -m node --loginall=automatic |
||||
|
||||
[Install] |
||||
WantedBy=sysinit.target |
||||
diff --git a/etc/systemd/iscsi_mark_root_nodes b/etc/systemd/iscsi_mark_root_nodes |
||||
deleted file mode 100644 |
||||
index c68475c..0000000 |
||||
--- a/etc/systemd/iscsi_mark_root_nodes |
||||
+++ /dev/null |
||||
@@ -1,14 +0,0 @@ |
||||
-#!/bin/bash |
||||
- |
||||
-ISCSIADM=/sbin/iscsiadm |
||||
-SESSION_FILE=/run/initramfs/iscsi.sessions |
||||
- |
||||
-if [ ! -f $SESSION_FILE ] ; then |
||||
- exit 0 |
||||
-fi |
||||
- |
||||
-while read t num i target; do |
||||
- ip=${i%:*} |
||||
- $ISCSIADM -m node -p $ip -T $target -o update -n node.startup -v onboot |
||||
-done < $SESSION_FILE |
||||
- |
||||
-- |
||||
1.8.1.4 |
||||
|
@ -0,0 +1,130 @@
@@ -0,0 +1,130 @@
|
||||
From 714a9dbed8e4c9d943ce34896a58d48a174f54cb Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Mon, 19 Nov 2012 16:37:13 -0800 |
||||
Subject: [PATCH] update initscripts and docs |
||||
|
||||
--- |
||||
README | 9 +++------ |
||||
etc/iscsid.conf | 23 +++++++++++------------ |
||||
usr/idbm.c | 4 ++++ |
||||
3 files changed, 18 insertions(+), 18 deletions(-) |
||||
|
||||
diff --git a/README b/README |
||||
index cbe8763..8db3013 100644 |
||||
--- a/README |
||||
+++ b/README |
||||
@@ -74,11 +74,6 @@ the cache sync command will fail. |
||||
- iscsiadm's -P 3 option will not print out scsi devices. |
||||
- iscsid will not automatically online devices. |
||||
|
||||
-You need to enable "Cryptographic API" under "Cryptographic options" in the |
||||
-kernel config. And you must enable "CRC32c CRC algorithm" even if |
||||
-you do not use header or data digests. They are the kernel options, |
||||
-CONFIG_CRYPTO and CONFIG_CRYPTO_CRC32C, respectively. |
||||
- |
||||
The userspace components: iscsid, iscsiadm and iscsistart require the |
||||
open-isns library which can be found here: |
||||
|
||||
@@ -1132,7 +1127,7 @@ Red Hat or Fedora: |
||||
----------------- |
||||
To start open-iscsi in Red Hat/Fedora you can do: |
||||
|
||||
- service open-iscsi start |
||||
+ service iscsi start |
||||
|
||||
To get open-iscsi to automatically start at run time you may have to |
||||
run: |
||||
@@ -1340,6 +1335,8 @@ iscsid will only perform rediscovery when it gets a SCN from the server. |
||||
# linux-isns (SLES's iSNS server) where it sometimes does not send SCN |
||||
# events in the proper format, so they may not get handled. |
||||
|
||||
+To set the startup value, so that nodes are not logged into automatically |
||||
+use the value "manual". |
||||
|
||||
Example: |
||||
-------- |
||||
diff --git a/etc/iscsid.conf b/etc/iscsid.conf |
||||
index c30a7dc..cfa6844 100644 |
||||
--- a/etc/iscsid.conf |
||||
+++ b/etc/iscsid.conf |
||||
@@ -17,10 +17,10 @@ |
||||
# maintainers. |
||||
# |
||||
# Default for Fedora and RHEL. (uncomment to activate). |
||||
-# iscsid.startup = /etc/rc.d/init.d/iscsid force-start |
||||
+iscsid.startup = /etc/rc.d/init.d/iscsid force-start |
||||
# |
||||
# Default for upstream open-iscsi scripts (uncomment to activate). |
||||
-iscsid.startup = /sbin/iscsid |
||||
+# iscsid.startup = /sbin/iscsid |
||||
|
||||
# Check for active mounts on devices reachable through a session |
||||
# and refuse to logout if there are any. Defaults to "No". |
||||
@@ -39,8 +39,8 @@ iscsid.startup = /sbin/iscsid |
||||
# To request that the iscsi initd scripts startup a session set to "automatic". |
||||
# node.startup = automatic |
||||
# |
||||
-# To manually startup the session set to "manual". The default is manual. |
||||
-node.startup = manual |
||||
+# To manually startup the session set to "manual". The default is automatic. |
||||
+node.startup = automatic |
||||
|
||||
# For "automatic" startup nodes, setting this to "Yes" will try logins on each |
||||
# available iface until one succeeds, and then stop. The default "No" will try |
||||
@@ -262,28 +262,27 @@ node.conn[0].iscsi.MaxXmitDataSegmentLength = 0 |
||||
discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768 |
||||
|
||||
# To allow the targets to control the setting of the digest checking, |
||||
-# with the initiator requesting a preference of enabling the checking, uncomment# one or both of the following lines: |
||||
+# with the initiator requesting a preference of enabling the checking, uncomment |
||||
+# the following lines (Data digests are not supported.): |
||||
#node.conn[0].iscsi.HeaderDigest = CRC32C,None |
||||
-#node.conn[0].iscsi.DataDigest = CRC32C,None |
||||
+ |
||||
# |
||||
# To allow the targets to control the setting of the digest checking, |
||||
# with the initiator requesting a preference of disabling the checking, |
||||
-# uncomment one or both of the following lines: |
||||
+# uncomment the following line: |
||||
#node.conn[0].iscsi.HeaderDigest = None,CRC32C |
||||
-#node.conn[0].iscsi.DataDigest = None,CRC32C |
||||
# |
||||
# To enable CRC32C digest checking for the header and/or data part of |
||||
-# iSCSI PDUs, uncomment one or both of the following lines: |
||||
+# iSCSI PDUs, uncomment the following line: |
||||
#node.conn[0].iscsi.HeaderDigest = CRC32C |
||||
-#node.conn[0].iscsi.DataDigest = CRC32C |
||||
# |
||||
# To disable digest checking for the header and/or data part of |
||||
-# iSCSI PDUs, uncomment one or both of the following lines: |
||||
+# iSCSI PDUs, uncomment the following line: |
||||
#node.conn[0].iscsi.HeaderDigest = None |
||||
-#node.conn[0].iscsi.DataDigest = None |
||||
# |
||||
# The default is to never use DataDigests or HeaderDigests. |
||||
# |
||||
+node.conn[0].iscsi.HeaderDigest = None |
||||
|
||||
# For multipath configurations, you may want more than one session to be |
||||
# created on each iface record. If node.session.nr_sessions is greater |
||||
diff --git a/usr/idbm.c b/usr/idbm.c |
||||
index 198a5ef..2d64172 100644 |
||||
--- a/usr/idbm.c |
||||
+++ b/usr/idbm.c |
||||
@@ -509,9 +509,13 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri) |
||||
IDBM_SHOW, "None", "CRC32C", "CRC32C,None", |
||||
"None,CRC32C", num, 1); |
||||
sprintf(key, CONN_DATA_DIGEST, i); |
||||
+ |
||||
+#if 0 |
||||
+We do not support data digests |
||||
__recinfo_int_o4(key, ri, r, conn[i].iscsi.DataDigest, IDBM_SHOW, |
||||
"None", "CRC32C", "CRC32C,None", |
||||
"None,CRC32C", num, 1); |
||||
+#endif |
||||
sprintf(key, CONN_IFMARKER, i); |
||||
__recinfo_int_o2(key, ri, r, conn[i].iscsi.IFMarker, IDBM_SHOW, |
||||
"No", "Yes", num, 1); |
||||
-- |
||||
2.5.5 |
||||
|
@ -0,0 +1,239 @@
@@ -0,0 +1,239 @@
|
||||
From c229e7d74a3103814403f7c242abcbaef211e259 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Mon, 19 Nov 2012 16:38:45 -0800 |
||||
Subject: use var for config |
||||
|
||||
--- |
||||
README | 33 ++++++++++++++++----------------- |
||||
doc/iscsiadm.8 | 8 ++++---- |
||||
usr/idbm.c | 6 +++--- |
||||
usr/idbm.h | 13 +++++++------ |
||||
usr/iface.h | 4 +++- |
||||
5 files changed, 33 insertions(+), 31 deletions(-) |
||||
|
||||
diff --git a/README b/README |
||||
index 3757b2d26d0d..fa38c8c82dcf 100644 |
||||
--- a/README |
||||
+++ b/README |
||||
@@ -170,8 +170,7 @@ Usage: iscsid [OPTION] |
||||
|
||||
Open-iSCSI persistent configuration is stored in a number of |
||||
directories under a configuration root directory, using a flat-file |
||||
-format. This configuration root directory is /etc/iscsi by default, |
||||
-but may also commonly be in /var/lib/iscsi. |
||||
+format. This configuration root directory is /var/lib/iscsi by default. |
||||
|
||||
Configuration is contained in directories for: |
||||
|
||||
@@ -489,7 +488,7 @@ a scsi_host per HBA port). |
||||
To manage both types of initiator stacks, iscsiadm uses the interface (iface) |
||||
structure. For each HBA port or for software iscsi for each network |
||||
device (ethX) or NIC, that you wish to bind sessions to you must create |
||||
-a iface config /etc/iscsi/ifaces. |
||||
+a iface config /var/lib/iscsi/ifaces. |
||||
|
||||
Prep: |
||||
|
||||
@@ -523,29 +522,29 @@ Running: |
||||
iface0 qla4xxx,00:c0:dd:08:63:e8,20.15.0.7,default,iqn.2005-06.com.redhat:madmax |
||||
iface1 qla4xxx,00:c0:dd:08:63:ea,20.15.0.9,default,iqn.2005-06.com.redhat:madmax |
||||
|
||||
-Will report iface configurations that are setup in /etc/iscsi/ifaces. |
||||
+Will report iface configurations that are setup in /var/lib/iscsi/ifaces. |
||||
The format is: |
||||
|
||||
iface_name transport_name,hwaddress,ipaddress,net_ifacename,initiatorname |
||||
|
||||
For software iscsi, you can create the iface configs by hand, but it is |
||||
recommended that you use iscsiadm's iface mode. There is an iface.example in |
||||
-/etc/iscsi/ifaces which can be used as a template for the daring. |
||||
+/var/lib/iscsi/ifaces which can be used as a template for the daring. |
||||
|
||||
For each network object you wish to bind a session to you must create |
||||
-a separate iface config in /etc/iscsi/ifaces and each iface config file |
||||
+a separate iface config in /var/lib/iscsi/ifaces and each iface config file |
||||
must have a unique name which is less than or equal to 64 characters. |
||||
|
||||
Example: |
||||
|
||||
If you have NIC1 with MAC address 00:0F:1F:92:6B:BF and NIC2 with |
||||
MAC address 00:C0:DD:08:63:E7 and you wanted to do software iscsi over |
||||
-TCP/IP. Then in /etc/iscsi/ifaces/iface0 you would enter: |
||||
+TCP/IP. Then in /var/lib/iscsi/ifaces/iface0 you would enter: |
||||
|
||||
iface.transport_name = tcp |
||||
iface.hwaddress = 00:0F:1F:92:6B:BF |
||||
|
||||
-and in /etc/iscsi/ifaces/iface1 you would enter: |
||||
+and in /var/lib/iscsi/ifaces/iface1 you would enter: |
||||
|
||||
iface.transport_name = tcp |
||||
iface.hwaddress = 00:C0:DD:08:63:E7 |
||||
@@ -595,7 +594,7 @@ cxgb3i.00:07:43:05:97:07 cxgb3i,00:07:43:05:97:07,<empty>,<empty>,<empty> |
||||
qla4xxx.00:0e:1e:04:8b:2e qla4xxx,00:0e:1e:04:8b:2e,<empty>,<empty>,<empty> |
||||
|
||||
|
||||
-Will report iface configurations that are setup in /etc/iscsi/ifaces. |
||||
+Will report iface configurations that are setup in /var/lib/iscsi/ifaces. |
||||
The format is: |
||||
|
||||
iface_name transport_name,hwaddress,ipaddress,net_ifacename,initiatorname |
||||
@@ -681,7 +680,7 @@ need a separate network connection to the target for discovery purposes. |
||||
*This will be fixed in the next version of open-iscsi* |
||||
|
||||
For compatibility reasons, when you run iscsiadm to do discovery, it |
||||
-will check for interfaces in /etc/iscsi/iscsi/ifaces that are using |
||||
+will check for interfaces in /var/lib/iscsi/ifaces that are using |
||||
tcp for the iface.transport and it will bind the portals that are discovered |
||||
so that they will be logged in through those ifaces. This behavior can also |
||||
be overriden by passing in the interfaces you want to use. For the case |
||||
@@ -699,7 +698,7 @@ we do not bind a session to an iface, then you can use the special iface |
||||
|
||||
iscsiadm -m discoverydb -t st -p ip:port -I default --discover -P 1 |
||||
|
||||
-And if you did not define any interfaces in /etc/iscsi/ifaces and do |
||||
+And if you did not define any interfaces in /var/lib/iscsi/ifaces and do |
||||
not pass anything into iscsiadm, running iscsiadm will do the default |
||||
behavior, where we allow the network subsystem to decide which |
||||
device to use. |
||||
@@ -741,7 +740,7 @@ To now log into targets it is the same as with software iscsi. See section |
||||
|
||||
./iscsiadm -m discoverydb -t st -p 192.168.1.1:3260 --discover |
||||
|
||||
- This will search /etc/iscsi/send_targets for a record with the |
||||
+ This will search /var/lib/iscsi/send_targets for a record with the |
||||
ID [portal = 192.168.1.1:3260 and type = sendtargets. If found it |
||||
will perform discovery using the settings stored in the record. |
||||
If a record does not exist, it will be created using the iscsid.conf |
||||
@@ -750,7 +749,7 @@ To now log into targets it is the same as with software iscsi. See section |
||||
The argument to -p may also be a hostname instead of an address. |
||||
./iscsiadm -m discoverydb -t st -p smoehost --discover |
||||
|
||||
- For the ifaces, iscsiadm will first search /etc/iscsi/ifaces for |
||||
+ For the ifaces, iscsiadm will first search /var/lib/iscsi/ifaces for |
||||
interfaces using software iscsi. If any are found then nodes found |
||||
during discovery will be setup so that they can logged in through |
||||
those interfaces. To specify a specific iface, pass the |
||||
@@ -806,7 +805,7 @@ To now log into targets it is the same as with software iscsi. See section |
||||
This command will perform discovery, but not manipulate the node DB. |
||||
|
||||
- SendTargets iSCSI Discovery with a specific interface. If you |
||||
- wish to only use a subset of the interfaces in /etc/iscsi/ifaces |
||||
+ wish to only use a subset of the interfaces in /var/lib/iscsi/ifaces |
||||
then you can pass them in during discovery: |
||||
|
||||
./iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \ |
||||
@@ -1207,8 +1206,8 @@ where targetname is the name of the target and ip_address:port is the address |
||||
and port of the portal. tpgt, is the portal group tag of |
||||
the portal, and is not used in iscsiadm commands except for static |
||||
record creation. And iface name is the name of the iscsi interface |
||||
-defined in /etc/iscsi/ifaces. If no interface was defined in |
||||
-/etc/iscsi/ifaces or passed in, the default behavior is used. |
||||
+defined in /var/lib/iscsi/ifaces. If no interface was defined in |
||||
+/var/lib/iscsi/ifaces or passed in, the default behavior is used. |
||||
Default here is iscsi_tcp/tcp to be used over which ever NIC the |
||||
network layer decides is best. |
||||
|
||||
@@ -1323,7 +1322,7 @@ If set, iscsid will perform discovery to the address every |
||||
discovery.isns.discoveryd_poll_inval or |
||||
discovery.sendtargets.discoveryd_poll_inval seconds, |
||||
and it will log into any portals found from the discovery source using |
||||
-the ifaces in /etc/iscsi/ifaces. |
||||
+the ifaces in /var/lib/iscsi/ifaces. |
||||
|
||||
Note that for iSNS the poll_interval does not have to be set. If not set, |
||||
iscsid will only perform rediscovery when it gets a SCN from the server. |
||||
diff --git a/doc/iscsiadm.8 b/doc/iscsiadm.8 |
||||
index a82805e28fb9..758a47c2d1fe 100644 |
||||
--- a/doc/iscsiadm.8 |
||||
+++ b/doc/iscsiadm.8 |
||||
@@ -241,7 +241,7 @@ This option is only valid for ping submode. |
||||
.TP |
||||
\fB\-I\fR, \fB\-\-interface=\fI[iface]\fR |
||||
The interface argument specifies the iSCSI interface to use for the operation. |
||||
-iSCSI interfaces (iface) are defined in /etc/iscsi/ifaces. For hardware |
||||
+iSCSI interfaces (iface) are defined in /var/lib/iscsi/ifaces. For hardware |
||||
iSCSI (qla4xxx) the iface config must have the hardware address |
||||
(iface.hwaddress = port's MAC address) |
||||
and the driver/transport_name (iface.transport_name). The iface's name is |
||||
@@ -318,7 +318,7 @@ If no other options are specified: for \fIdiscovery\fR, \fIdiscoverydb\fR and |
||||
\fInode\fR, all of their respective records are displayed; for \fIsession\fR, |
||||
all active sessions and connections are displayed; for \fIfw\fR, all boot |
||||
firmware values are displayed; for \fIhost\fR, all iSCSI hosts are displayed; |
||||
-and for \fIiface\fR, all ifaces setup in /etc/iscsi/ifaces are displayed. |
||||
+and for \fIiface\fR, all ifaces setup in /var/lib/iscsi/ifaces are displayed. |
||||
|
||||
.TP |
||||
\fB\-n\fR, \fB\-\-name=\fIname\fR |
||||
@@ -703,10 +703,10 @@ The configuration file read by \fBiscsid\fR and \fBiscsiadm\fR on startup. |
||||
The file containing the iSCSI InitiatorName and InitiatorAlias read by |
||||
\fBiscsid\fR and \fBiscsiadm\fR on startup. |
||||
.TP |
||||
-/etc/iscsi/nodes/ |
||||
+/var/lib/iscsi/nodes/ |
||||
This directory contains the nodes with their targets. |
||||
.TP |
||||
-/etc/iscsi/send_targets |
||||
+/var/lib/iscsi/send_targets |
||||
This directory contains the portals. |
||||
|
||||
.SH "SEE ALSO" |
||||
diff --git a/usr/idbm.c b/usr/idbm.c |
||||
index 2fe424fb66ba..a749cc8ea3f8 100644 |
||||
--- a/usr/idbm.c |
||||
+++ b/usr/idbm.c |
||||
@@ -2917,9 +2917,9 @@ free_info: |
||||
int idbm_init(idbm_get_config_file_fn *fn) |
||||
{ |
||||
/* make sure root db dir is there */ |
||||
- if (access(ISCSI_CONFIG_ROOT, F_OK) != 0) { |
||||
- if (mkdir(ISCSI_CONFIG_ROOT, 0660) != 0) { |
||||
- log_error("Could not make %s %d", ISCSI_CONFIG_ROOT, |
||||
+ if (access(ISCSIVAR, F_OK) != 0) { |
||||
+ if (mkdir(ISCSIVAR, 0660) != 0) { |
||||
+ log_error("Could not make %s %d", ISCSIVAR, |
||||
errno); |
||||
return errno; |
||||
} |
||||
diff --git a/usr/idbm.h b/usr/idbm.h |
||||
index b9020fe4fd0a..b89ddffe55df 100644 |
||||
--- a/usr/idbm.h |
||||
+++ b/usr/idbm.h |
||||
@@ -29,12 +29,13 @@ |
||||
#include "list.h" |
||||
#include "flashnode.h" |
||||
|
||||
-#define NODE_CONFIG_DIR ISCSI_CONFIG_ROOT"nodes" |
||||
-#define SLP_CONFIG_DIR ISCSI_CONFIG_ROOT"slp" |
||||
-#define ISNS_CONFIG_DIR ISCSI_CONFIG_ROOT"isns" |
||||
-#define STATIC_CONFIG_DIR ISCSI_CONFIG_ROOT"static" |
||||
-#define FW_CONFIG_DIR ISCSI_CONFIG_ROOT"fw" |
||||
-#define ST_CONFIG_DIR ISCSI_CONFIG_ROOT"send_targets" |
||||
+#define ISCSIVAR "/var/lib/iscsi/" |
||||
+#define NODE_CONFIG_DIR ISCSIVAR"nodes" |
||||
+#define SLP_CONFIG_DIR ISCSIVAR"slp" |
||||
+#define ISNS_CONFIG_DIR ISCSIVAR"isns" |
||||
+#define STATIC_CONFIG_DIR ISCSIVAR"static" |
||||
+#define FW_CONFIG_DIR ISCSIVAR"fw" |
||||
+#define ST_CONFIG_DIR ISCSIVAR"send_targets" |
||||
#define ST_CONFIG_NAME "st_config" |
||||
#define ISNS_CONFIG_NAME "isns_config" |
||||
|
||||
diff --git a/usr/iface.h b/usr/iface.h |
||||
index 01f70747dadd..f396918ccc15 100644 |
||||
--- a/usr/iface.h |
||||
+++ b/usr/iface.h |
||||
@@ -20,7 +20,9 @@ |
||||
#ifndef ISCSI_IFACE_H |
||||
#define ISCSI_IFACE_H |
||||
|
||||
-#define IFACE_CONFIG_DIR ISCSI_CONFIG_ROOT"ifaces" |
||||
+#include "idbm.h" |
||||
+ |
||||
+#define IFACE_CONFIG_DIR ISCSIVAR"ifaces" |
||||
|
||||
struct iface_rec; |
||||
struct list_head; |
||||
-- |
||||
2.9.3 |
||||
|
@ -0,0 +1,39 @@
@@ -0,0 +1,39 @@
|
||||
From 7f12a1ca8fe699958903278d010cf22d0a98767b Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Mon, 19 Nov 2012 16:40:04 -0800 |
||||
Subject: use red hat for name |
||||
|
||||
--- |
||||
doc/iscsi-iname.8 | 2 +- |
||||
utils/iscsi-iname.c | 2 +- |
||||
2 files changed, 2 insertions(+), 2 deletions(-) |
||||
|
||||
diff --git a/doc/iscsi-iname.8 b/doc/iscsi-iname.8 |
||||
index a55d666d1af3..dd77ed9f3165 100644 |
||||
--- a/doc/iscsi-iname.8 |
||||
+++ b/doc/iscsi-iname.8 |
||||
@@ -14,7 +14,7 @@ generates a unique iSCSI node name on every invocation. |
||||
Display help |
||||
.TP |
||||
.BI [-p=]\fIprefix\fP |
||||
-Use the prefix passed in instead of the default "iqn.2005-03.org.open-iscsi" |
||||
+Use the prefix passed in instead of the default "iqn.1994-05.com.redhat" |
||||
|
||||
.SH AUTHORS |
||||
Open-iSCSI project <http://www.open-iscsi.com/> |
||||
diff --git a/utils/iscsi-iname.c b/utils/iscsi-iname.c |
||||
index 6347edc46293..cb2f6c8b8651 100644 |
||||
--- a/utils/iscsi-iname.c |
||||
+++ b/utils/iscsi-iname.c |
||||
@@ -73,7 +73,7 @@ main(int argc, char *argv[]) |
||||
exit(0); |
||||
} |
||||
} else { |
||||
- prefix = "iqn.2005-03.org.open-iscsi"; |
||||
+ prefix = "iqn.1994-05.com.redhat"; |
||||
} |
||||
|
||||
/* try to feed some entropy from the pool to MD5 in order to get |
||||
-- |
||||
2.9.5 |
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
From aa58a042ec20575143c1a5c813c9552a286aeb0e Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Mon, 19 Nov 2012 17:09:24 -0800 |
||||
Subject: remove the offload boot supported ifdef |
||||
|
||||
--- |
||||
usr/iface.c | 7 +------ |
||||
1 file changed, 1 insertion(+), 6 deletions(-) |
||||
|
||||
diff --git a/usr/iface.c b/usr/iface.c |
||||
index c86892e..f5441c0 100644 |
||||
--- a/usr/iface.c |
||||
+++ b/usr/iface.c |
||||
@@ -895,6 +895,7 @@ int iface_setup_from_boot_context(struct iface_rec *iface, |
||||
{ |
||||
struct iscsi_transport *t = NULL; |
||||
uint32_t hostno; |
||||
+ int rc; |
||||
|
||||
if (strlen(context->initiatorname)) |
||||
strlcpy(iface->iname, context->initiatorname, |
||||
@@ -907,10 +908,7 @@ int iface_setup_from_boot_context(struct iface_rec *iface, |
||||
return 0; |
||||
} |
||||
} else if (strlen(context->iface)) { |
||||
-/* this ifdef is only temp until distros and firmwares are updated */ |
||||
-#ifdef OFFLOAD_BOOT_SUPPORTED |
||||
char transport_name[ISCSI_TRANSPORT_NAME_MAXLEN]; |
||||
- int rc; |
||||
|
||||
memset(transport_name, 0, ISCSI_TRANSPORT_NAME_MAXLEN); |
||||
/* make sure offload driver is loaded */ |
||||
@@ -936,9 +934,6 @@ int iface_setup_from_boot_context(struct iface_rec *iface, |
||||
} |
||||
|
||||
strlcpy(iface->netdev, context->iface, sizeof(iface->netdev)); |
||||
-#else |
||||
- return 0; |
||||
-#endif |
||||
} else |
||||
return 0; |
||||
|
||||
-- |
||||
1.7.11.7 |
||||
|
@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
From 822b53e6c9ebb0fe7236ebd3b4c73b009100592d Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Tue, 22 Jan 2013 14:27:12 -0800 |
||||
Subject: iscsiuio systemd unit files |
||||
|
||||
--- |
||||
etc/systemd/iscsiuio.service | 17 +++++++++++++++++ |
||||
etc/systemd/iscsiuio.socket | 9 +++++++++ |
||||
2 files changed, 26 insertions(+) |
||||
create mode 100644 etc/systemd/iscsiuio.service |
||||
create mode 100644 etc/systemd/iscsiuio.socket |
||||
|
||||
diff --git a/etc/systemd/iscsiuio.service b/etc/systemd/iscsiuio.service |
||||
new file mode 100644 |
||||
index 0000000..f0410b7 |
||||
--- /dev/null |
||||
+++ b/etc/systemd/iscsiuio.service |
||||
@@ -0,0 +1,17 @@ |
||||
+[Unit] |
||||
+Description=iSCSI UserSpace I/O driver |
||||
+Documentation=man:iscsiuio(8) |
||||
+DefaultDependencies=no |
||||
+Conflicts=shutdown.target |
||||
+Requires=iscsid.service |
||||
+BindTo=iscsid.service |
||||
+After=network.target |
||||
+Before=remote-fs-pre.target iscsid.service |
||||
+ |
||||
+[Service] |
||||
+Type=forking |
||||
+PIDFile=/var/run/iscsiuio.pid |
||||
+ExecStart=/usr/sbin/iscsiuio |
||||
+ |
||||
+[Install] |
||||
+WantedBy=multi-user.target |
||||
diff --git a/etc/systemd/iscsiuio.socket b/etc/systemd/iscsiuio.socket |
||||
new file mode 100644 |
||||
index 0000000..d42cedc |
||||
--- /dev/null |
||||
+++ b/etc/systemd/iscsiuio.socket |
||||
@@ -0,0 +1,9 @@ |
||||
+[Unit] |
||||
+Description=Open-iSCSI iscsiuio Socket |
||||
+Documentation=man:iscsiuio(8) |
||||
+ |
||||
+[Socket] |
||||
+ListenStream=@ISCSID_UIP_ABSTRACT_NAMESPACE |
||||
+ |
||||
+[Install] |
||||
+WantedBy=sockets.target |
||||
-- |
||||
1.7.11.7 |
||||
|
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
From c3d2b8f3de5b6161845304cf46982d2c5a9918b6 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Thu Feb 21 21:05:39 PST 2013 |
||||
Subject: disable iscsid.startup from iscsiadm, prefer systemd socket activation |
||||
|
||||
--- |
||||
etc/iscsid.conf | 2 +- |
||||
1 file changed, 1 insertion(+), 1 deletion(-) |
||||
|
||||
diff --git a/etc/iscsid.conf b/etc/iscsid.conf |
||||
index ac1d231..5851fa5 100644 |
||||
--- a/etc/iscsid.conf |
||||
+++ b/etc/iscsid.conf |
||||
@@ -17,7 +17,7 @@ |
||||
# maintainers. |
||||
# |
||||
# Default for Fedora and RHEL. (uncomment to activate). |
||||
-iscsid.startup = /etc/rc.d/init.d/iscsid force-start |
||||
+#iscsid.startup = /bin/systemctl start iscsid.service |
||||
# |
||||
# Default for upstream open-iscsi scripts (uncomment to activate). |
||||
# iscsid.startup = /sbin/iscsid |
||||
-- |
||||
1.7.11.7 |
||||
|
@ -0,0 +1,39 @@
@@ -0,0 +1,39 @@
|
||||
From bc4cf1487b4d6039de2a082c1786ac83ab148c88 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Tue, 22 Jan 2013 15:14:21 -0800 |
||||
Subject: resolve 565245: multilib issues caused by doxygen |
||||
|
||||
--- |
||||
libiscsi/libiscsi.doxy | 2 +- |
||||
libiscsi/no_date_footer.html | 6 ++++++ |
||||
2 files changed, 7 insertions(+), 1 deletion(-) |
||||
create mode 100644 libiscsi/no_date_footer.html |
||||
|
||||
diff --git a/libiscsi/libiscsi.doxy b/libiscsi/libiscsi.doxy |
||||
index 663770f..7a5ff7f 100644 |
||||
--- a/libiscsi/libiscsi.doxy |
||||
+++ b/libiscsi/libiscsi.doxy |
||||
@@ -765,7 +765,7 @@ HTML_HEADER = |
||||
# each generated HTML page. If it is left blank doxygen will generate a |
||||
# standard footer. |
||||
|
||||
-HTML_FOOTER = |
||||
+HTML_FOOTER = no_date_footer.html |
||||
|
||||
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading |
||||
# style sheet that is used by each HTML page. It can be used to |
||||
diff --git a/libiscsi/no_date_footer.html b/libiscsi/no_date_footer.html |
||||
new file mode 100644 |
||||
index 0000000..1e0c6c4 |
||||
--- /dev/null |
||||
+++ b/libiscsi/no_date_footer.html |
||||
@@ -0,0 +1,6 @@ |
||||
+<hr size="1"><address style="text-align: right;"><small> |
||||
+Generated for $projectname by <a href="http://www.doxygen.org/ |
||||
+index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> |
||||
+$doxygenversion</small></address> |
||||
+</body> |
||||
+</html> |
||||
-- |
||||
1.7.11.7 |
||||
|
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
From ab79bdb20e37216ca969e06d63a952acfd023963 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Tue, 28 May 2013 13:12:27 -0700 |
||||
Subject: [PATCH] Don't check for autostart sessions if iscsi is not used (bug |
||||
#951951) |
||||
|
||||
Change conditional startup in iscsi.service to check for a non-empty |
||||
nodes directory, instead of initiator-name. This fits better with what |
||||
it's doing, as there's no need to scan for autostart node records if |
||||
there are no node records at all. |
||||
--- |
||||
etc/systemd/iscsi.service | 2 +- |
||||
1 file changed, 1 insertion(+), 1 deletion(-) |
||||
|
||||
diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service |
||||
index bbd52fd..7b4efee 100644 |
||||
--- a/etc/systemd/iscsi.service |
||||
+++ b/etc/systemd/iscsi.service |
||||
@@ -5,7 +5,7 @@ DefaultDependencies=no |
||||
Conflicts=shutdown.target |
||||
After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service |
||||
Before=remote-fs-pre.target |
||||
-ConditionPathExists=/etc/iscsi/initiatorname.iscsi |
||||
+ConditionDirectoryNotEmpty=/var/lib/iscsi/nodes |
||||
|
||||
[Service] |
||||
Type=oneshot |
||||
-- |
||||
1.8.1.4 |
||||
|
@ -0,0 +1,52 @@
@@ -0,0 +1,52 @@
|
||||
From fcad7de1a8c3d140d1d0eb120727966017d3727b Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Sat, 17 Aug 2013 15:50:45 -0700 |
||||
Subject: libiscsi: fix incorrect strncpy use |
||||
|
||||
Changes to internal structures make the src and dst buffers of some |
||||
copies (potentially) different sizes. Fix strncpy calls that were using |
||||
the size of the src argument as the limit. |
||||
--- |
||||
libiscsi/libiscsi.c | 19 ++++++++----------- |
||||
1 file changed, 8 insertions(+), 11 deletions(-) |
||||
|
||||
diff --git a/libiscsi/libiscsi.c b/libiscsi/libiscsi.c |
||||
index 6e6846a..064e4b5 100644 |
||||
--- a/libiscsi/libiscsi.c |
||||
+++ b/libiscsi/libiscsi.c |
||||
@@ -587,15 +587,13 @@ int libiscsi_get_firmware_network_config( |
||||
return ENODEV; |
||||
|
||||
config->dhcp = strlen(fw_entry.dhcp) ? 1 : 0; |
||||
- strncpy(config->iface_name, fw_entry.iface, sizeof fw_entry.iface); |
||||
- strncpy(config->mac_address, fw_entry.mac, sizeof fw_entry.mac); |
||||
- strncpy(config->ip_address, fw_entry.ipaddr, sizeof fw_entry.ipaddr); |
||||
- strncpy(config->netmask, fw_entry.mask, sizeof fw_entry.mask); |
||||
- strncpy(config->gateway, fw_entry.gateway, sizeof fw_entry.gateway); |
||||
- strncpy(config->primary_dns, fw_entry.primary_dns, |
||||
- sizeof fw_entry.primary_dns); |
||||
- strncpy(config->secondary_dns, fw_entry.secondary_dns, |
||||
- sizeof fw_entry.secondary_dns); |
||||
+ strlcpy(config->iface_name, fw_entry.iface, LIBISCSI_VALUE_MAXLEN); |
||||
+ strlcpy(config->mac_address, fw_entry.mac, LIBISCSI_VALUE_MAXLEN); |
||||
+ strlcpy(config->ip_address, fw_entry.ipaddr, LIBISCSI_VALUE_MAXLEN); |
||||
+ strlcpy(config->netmask, fw_entry.mask, LIBISCSI_VALUE_MAXLEN); |
||||
+ strlcpy(config->gateway, fw_entry.gateway, LIBISCSI_VALUE_MAXLEN); |
||||
+ strlcpy(config->primary_dns, fw_entry.primary_dns, LIBISCSI_VALUE_MAXLEN); |
||||
+ strlcpy(config->secondary_dns, fw_entry.secondary_dns, LIBISCSI_VALUE_MAXLEN); |
||||
return 0; |
||||
} |
||||
|
||||
@@ -613,8 +611,7 @@ int libiscsi_get_firmware_initiator_name(char *initiatorname) |
||||
if (fw_get_entry(&fw_entry)) |
||||
return ENODEV; |
||||
|
||||
- strncpy(initiatorname, fw_entry.initiatorname, |
||||
- sizeof fw_entry.initiatorname); |
||||
+ strlcpy(initiatorname, fw_entry.initiatorname, LIBISCSI_VALUE_MAXLEN); |
||||
|
||||
return 0; |
||||
} |
||||
-- |
||||
1.8.1.4 |
||||
|
@ -0,0 +1,28 @@
@@ -0,0 +1,28 @@
|
||||
From 89e9c2ff66d069b812fabcd4fefe453bbcea73e4 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Mon, 25 Nov 2013 22:28:12 -0800 |
||||
Subject: [PATCH] start socket listeners on iscsiadm command |
||||
|
||||
fix for trying to run iscsiadm commands right after installing the rpm |
||||
without manually starting the systemd units |
||||
--- |
||||
etc/iscsid.conf | 3 ++- |
||||
1 file changed, 2 insertions(+), 1 deletion(-) |
||||
|
||||
diff --git a/etc/iscsid.conf b/etc/iscsid.conf |
||||
index 1fd3000..412f130 100644 |
||||
--- a/etc/iscsid.conf |
||||
+++ b/etc/iscsid.conf |
||||
@@ -17,7 +17,8 @@ |
||||
# maintainers. |
||||
# |
||||
# Default for Fedora and RHEL. (uncomment to activate). |
||||
-#iscsid.startup = /bin/systemctl start iscsid.service |
||||
+# Use socket activation, but try to make sure the socket units are listening |
||||
+iscsid.startup = /bin/systemctl start iscsid.socket iscsiuio.socket |
||||
# |
||||
# Default for upstream open-iscsi scripts (uncomment to activate). |
||||
# iscsid.startup = /sbin/iscsid |
||||
-- |
||||
1.8.3.1 |
||||
|
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
From 1c0f37a8ae48daa3ae1c37cdac7c0789299180eb Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Mon, 24 Feb 2014 09:33:33 -0800 |
||||
Subject: [PATCH] Revert "iscsiadm: return error when login fails" |
||||
|
||||
This reverts commit fc2a8e9a2911bc76f961fe3e4a159fab9b8b9691. |
||||
|
||||
Done to address RHBZ #1015563 |
||||
|
||||
--- |
||||
usr/session_mgmt.c | 4 ++-- |
||||
1 file changed, 2 insertions(+), 2 deletions(-) |
||||
|
||||
diff --git a/usr/session_mgmt.c b/usr/session_mgmt.c |
||||
index 87b8e00..3815b1d 100644 |
||||
--- a/usr/session_mgmt.c |
||||
+++ b/usr/session_mgmt.c |
||||
@@ -178,12 +178,12 @@ int iscsi_login_portal(void *data, struct list_head *list, struct node_rec *rec) |
||||
goto done; |
||||
} |
||||
if (session_count >= rec->session.nr_sessions) { |
||||
- log_warning("%s: %d session%s requested, but %d " |
||||
+ log_debug(1, "%s: %d session%s requested, but %d " |
||||
"already present.", |
||||
rec->iface.name, rec->session.nr_sessions, |
||||
rec->session.nr_sessions == 1 ? "" : "s", |
||||
session_count); |
||||
- rc = ISCSI_ERR_SESS_EXISTS; |
||||
+ rc = 0; |
||||
goto done; |
||||
} |
||||
|
||||
-- |
||||
1.8.3.1 |
||||
|
@ -0,0 +1,55 @@
@@ -0,0 +1,55 @@
|
||||
From 83f291bd475f3d11abaf1f7346732f75af585ed8 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Wed, 26 Feb 2014 16:33:48 -0800 |
||||
Subject: update handling of boot sessions |
||||
|
||||
force start iscsiuio if needed, socket activation does not seem to be |
||||
working for recovery |
||||
--- |
||||
etc/systemd/iscsi-mark-root-nodes | 29 +++++++++++++++++++++++------ |
||||
1 file changed, 23 insertions(+), 6 deletions(-) |
||||
|
||||
diff --git a/etc/systemd/iscsi-mark-root-nodes b/etc/systemd/iscsi-mark-root-nodes |
||||
index 157be62..d106ac6 100644 |
||||
--- a/etc/systemd/iscsi-mark-root-nodes |
||||
+++ b/etc/systemd/iscsi-mark-root-nodes |
||||
@@ -1,13 +1,30 @@ |
||||
#!/bin/bash |
||||
|
||||
ISCSIADM=/sbin/iscsiadm |
||||
+start_iscsid=0 |
||||
+start_iscsiuio=0 |
||||
|
||||
-$ISCSIADM -m session >/dev/null 2>&1 || exit 0 |
||||
+while read t num p target flash; do |
||||
+ # strip tag number from portal, keep "ip:port" |
||||
+ portal=${p%,*} |
||||
+ transport=${t%:} |
||||
|
||||
-$ISCSIADM -m session | while read t num i target; do |
||||
- ip=${i%:*} |
||||
- $ISCSIADM -m node -p $ip -T $target -o update -n node.startup -v onboot |
||||
-done |
||||
+ $ISCSIADM -m node -p $portal -T $target -o update -n node.startup -v onboot |
||||
|
||||
-systemctl start iscsid.service |
||||
+ start_iscsid=1 |
||||
+ |
||||
+ if [ "$transport" = bnx2i ] || [ "$transport" = qedi ]; then |
||||
+ start_iscsiuio=1 |
||||
+ fi |
||||
+done < <( $ISCSIADM -m session ) |
||||
+ |
||||
+# force iscsid and iscsiuio to start if needed for |
||||
+# recovering sessions created in the initrd |
||||
+ |
||||
+if [ "$start_iscsid" -eq 1 ]; then |
||||
+ systemctl --no-block start iscsid.service |
||||
+fi |
||||
+if [ "$start_iscsiuio" -eq 1 ]; then |
||||
+ systemctl --no-block start iscsiuio.service |
||||
+fi |
||||
|
||||
-- |
||||
1.8.3.1 |
||||
|
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
From 969e26197c792ec5377d2c261a934a9c907e82f0 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Fri, 14 Mar 2014 09:22:21 -0700 |
||||
Subject: [PATCH] update iscsi.service for boot session recovery |
||||
|
||||
--- |
||||
etc/systemd/iscsi.service | 5 +++-- |
||||
1 file changed, 3 insertions(+), 2 deletions(-) |
||||
|
||||
diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service |
||||
index d5712bd..3de76c5 100644 |
||||
--- a/etc/systemd/iscsi.service |
||||
+++ b/etc/systemd/iscsi.service |
||||
@@ -5,14 +5,15 @@ DefaultDependencies=no |
||||
Conflicts=shutdown.target |
||||
After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service |
||||
Before=remote-fs-pre.target |
||||
-ConditionDirectoryNotEmpty=/var/lib/iscsi/nodes |
||||
+ConditionDirectoryNotEmpty=|/var/lib/iscsi/nodes |
||||
+ConditionDirectoryNotEmpty=|/sys/class/iscsi_session |
||||
|
||||
[Service] |
||||
Type=oneshot |
||||
RemainAfterExit=true |
||||
ExecStart=/usr/libexec/iscsi-mark-root-nodes |
||||
+SuccessExitStatus=21 |
||||
ExecStart=/sbin/iscsiadm -m node --loginall=automatic |
||||
-ExecStop=/bin/sync |
||||
ExecStop=/sbin/iscsiadm -m node --logoutall=automatic |
||||
ExecReload=/sbin/iscsiadm -m node --loginall=automatic |
||||
|
||||
-- |
||||
1.8.3.1 |
||||
|
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
From 347e6120213efda47a45443b4e366ed1400433c1 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Wed, 17 Sep 2014 09:58:39 -0700 |
||||
Subject: [PATCH] updates to iscsi.service |
||||
|
||||
Resolves: #1126524 |
||||
Resolves: #1111925 |
||||
--- |
||||
etc/systemd/iscsi.service | 10 +++++----- |
||||
1 file changed, 5 insertions(+), 5 deletions(-) |
||||
|
||||
diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service |
||||
index 3de76c5..ad7be34 100644 |
||||
--- a/etc/systemd/iscsi.service |
||||
+++ b/etc/systemd/iscsi.service |
||||
@@ -5,17 +5,17 @@ DefaultDependencies=no |
||||
Conflicts=shutdown.target |
||||
After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service |
||||
Before=remote-fs-pre.target |
||||
+Wants=remote-fs-pre.target |
||||
ConditionDirectoryNotEmpty=|/var/lib/iscsi/nodes |
||||
ConditionDirectoryNotEmpty=|/sys/class/iscsi_session |
||||
|
||||
[Service] |
||||
Type=oneshot |
||||
RemainAfterExit=true |
||||
-ExecStart=/usr/libexec/iscsi-mark-root-nodes |
||||
-SuccessExitStatus=21 |
||||
-ExecStart=/sbin/iscsiadm -m node --loginall=automatic |
||||
-ExecStop=/sbin/iscsiadm -m node --logoutall=automatic |
||||
-ExecReload=/sbin/iscsiadm -m node --loginall=automatic |
||||
+ExecStart=-/usr/libexec/iscsi-mark-root-nodes |
||||
+ExecStart=-/sbin/iscsiadm -m node --loginall=automatic |
||||
+ExecStop=-/sbin/iscsiadm -m node --logoutall=automatic |
||||
+ExecReload=-/sbin/iscsiadm -m node --loginall=automatic |
||||
|
||||
[Install] |
||||
WantedBy=sysinit.target |
||||
-- |
||||
1.9.3 |
||||
|
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
From 56d9d1c6a02dcad0915c0673f9cd2e653c86302f Mon Sep 17 00:00:00 2001 |
||||
From: rpm-build <rpm-build> |
||||
Date: Tue, 13 Jan 2015 16:30:01 -0800 |
||||
Subject: [PATCH] 0171-make-session-shutdown-a-seperate-service.patch |
||||
|
||||
--- |
||||
etc/systemd/iscsi-shutdown.service | 14 ++++++++++++++ |
||||
etc/systemd/iscsi.service | 3 +-- |
||||
2 files changed, 15 insertions(+), 2 deletions(-) |
||||
create mode 100644 etc/systemd/iscsi-shutdown.service |
||||
|
||||
diff --git a/etc/systemd/iscsi-shutdown.service b/etc/systemd/iscsi-shutdown.service |
||||
new file mode 100644 |
||||
index 0000000..23758e9 |
||||
--- /dev/null |
||||
+++ b/etc/systemd/iscsi-shutdown.service |
||||
@@ -0,0 +1,15 @@ |
||||
+[Unit] |
||||
+Description=Logout off all iSCSI sessions on shutdown |
||||
+Documentation=man:iscsid(8) man:iscsiadm(8) |
||||
+DefaultDependencies=no |
||||
+Conflicts=shutdown.target |
||||
+After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service |
||||
+Before=remote-fs-pre.target |
||||
+Wants=remote-fs-pre.target |
||||
+RefuseManualStop=yes |
||||
+ |
||||
+[Service] |
||||
+Type=oneshot |
||||
+RemainAfterExit=true |
||||
+ExecStart=-/bin/true |
||||
+ExecStop=-/sbin/iscsiadm -m node --logoutall=all |
||||
diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service |
||||
index ad7be34..2736956 100644 |
||||
--- a/etc/systemd/iscsi.service |
||||
+++ b/etc/systemd/iscsi.service |
||||
@@ -5,7 +5,7 @@ DefaultDependencies=no |
||||
Conflicts=shutdown.target |
||||
After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service |
||||
Before=remote-fs-pre.target |
||||
-Wants=remote-fs-pre.target |
||||
+Wants=remote-fs-pre.target iscsi-shutdown.service |
||||
ConditionDirectoryNotEmpty=|/var/lib/iscsi/nodes |
||||
ConditionDirectoryNotEmpty=|/sys/class/iscsi_session |
||||
|
||||
@@ -14,7 +14,6 @@ Type=oneshot |
||||
RemainAfterExit=true |
||||
ExecStart=-/usr/libexec/iscsi-mark-root-nodes |
||||
ExecStart=-/sbin/iscsiadm -m node --loginall=automatic |
||||
-ExecStop=-/sbin/iscsiadm -m node --logoutall=automatic |
||||
ExecReload=-/sbin/iscsiadm -m node --loginall=automatic |
||||
|
||||
[Install] |
||||
-- |
||||
2.1.0 |
||||
|
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
From 8f7669c48198989eac5e08664133f56371ad963b Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Mon, 21 Jan 2013 15:43:36 -0800 |
||||
Subject: use Red Hat version string to match RPM package version |
||||
|
||||
--- |
||||
usr/version.h | 2 +- |
||||
1 file changed, 1 insertion(+), 1 deletion(-) |
||||
|
||||
diff --git a/usr/version.h b/usr/version.h |
||||
index 20f07946be1f..baa8c00c7185 100644 |
||||
--- a/usr/version.h |
||||
+++ b/usr/version.h |
||||
@@ -6,7 +6,7 @@ |
||||
* This may not be the same value as the kernel versions because |
||||
* some other maintainer could merge a patch without going through us |
||||
*/ |
||||
-#define ISCSI_VERSION_STR "2.0-874" |
||||
+#define ISCSI_VERSION_STR "6.2.0.874-7" |
||||
#define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version" |
||||
|
||||
#endif |
||||
-- |
||||
2.9.3 |
||||
|
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh |
||||
|
||||
case "$2" in |
||||
up|vpn-up) |
||||
/bin/systemctl --no-block reload iscsi.service || : |
||||
;; |
||||
esac |
@ -0,0 +1,191 @@
@@ -0,0 +1,191 @@
|
||||
commit ea9c14d9ab10d1070a8d3c032e64bb946a279a02 |
||||
Author: Chris Leech <cleech@redhat.com> |
||||
Date: Thu Nov 30 12:05:28 2017 -0800 |
||||
|
||||
vlan setting sync for be2iscsi |
||||
|
||||
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c |
||||
index b30518a293db..f269fc406a13 100644 |
||||
--- a/usr/iscsiadm.c |
||||
+++ b/usr/iscsiadm.c |
||||
@@ -2311,6 +2311,89 @@ static int verify_iface_params(struct list_head *params, struct node_rec *rec) |
||||
return 0; |
||||
} |
||||
|
||||
+static int iface_param_update(struct iface_rec *iface, struct list_head *params) |
||||
+{ |
||||
+ struct node_rec *rec; |
||||
+ int rc = 0; |
||||
+ |
||||
+ rec = idbm_create_rec(NULL, -1, NULL, -1, iface, 1); |
||||
+ if (!rec) { |
||||
+ rc = ISCSI_ERR_INVAL; |
||||
+ goto update_fail; |
||||
+ } |
||||
+ |
||||
+ if (iscsi_check_for_running_session(rec)) |
||||
+ log_warning("Updating iface while iscsi sessions " |
||||
+ "are using it. You must logout the running " |
||||
+ "sessions then log back in for the " |
||||
+ "new settings to take affect."); |
||||
+ |
||||
+ rc = verify_iface_params(params, rec); |
||||
+ if (rc) |
||||
+ goto update_fail; |
||||
+ |
||||
+ rc = iface_conf_update(params, &rec->iface); |
||||
+ if (rc) |
||||
+ goto update_fail; |
||||
+ |
||||
+ rc = __for_each_matched_rec(0, rec, params, idbm_node_set_param); |
||||
+ if (rc == ISCSI_ERR_NO_OBJS_FOUND) |
||||
+ rc = 0; |
||||
+ else if (rc) |
||||
+ goto update_fail; |
||||
+ |
||||
+ printf("%s updated.\n", iface->name); |
||||
+ free(rec); |
||||
+ return rc; |
||||
+ |
||||
+update_fail: |
||||
+ log_error("Could not update iface %s: %s", |
||||
+ iface->name, iscsi_err_to_str(rc)); |
||||
+ free(rec); |
||||
+ return rc; |
||||
+} |
||||
+ |
||||
+struct iface_param_sync { |
||||
+ struct iface_rec *primary; |
||||
+ struct list_head *params; |
||||
+ int count; |
||||
+}; |
||||
+ |
||||
+static int update_sync_params(void *data, struct iface_rec *iface) |
||||
+{ |
||||
+ struct iface_param_sync *iface_params = data; |
||||
+ struct iface_rec *primary = iface_params->primary; |
||||
+ struct list_head *params = iface_params->params; |
||||
+ |
||||
+ if ((strcmp(primary->transport_name, iface->transport_name)) || |
||||
+ (strcmp(primary->hwaddress, iface->hwaddress)) || |
||||
+ (primary->iface_num != iface->iface_num)) |
||||
+ return 0; |
||||
+ |
||||
+ return iface_param_update(iface, params); |
||||
+} |
||||
+ |
||||
+static int split_vlan_params(struct list_head *params, struct list_head *vlan_params) |
||||
+{ |
||||
+ struct user_param *param, *tmp; |
||||
+ |
||||
+ list_for_each_entry_safe(param, tmp, params, list) { |
||||
+ if (!strncmp(param->name, "iface.vlan", 10)) { |
||||
+ list_move_tail(¶m->list, vlan_params); |
||||
+ } |
||||
+ } |
||||
+ return 0; |
||||
+} |
||||
+ |
||||
+static inline void list_splice_tail(struct list_head *list, struct list_head *head) |
||||
+{ |
||||
+ list->prev->next = head; |
||||
+ list->next->prev = head->prev; |
||||
+ head->prev->next = list->next; |
||||
+ head->prev = list->prev; |
||||
+ INIT_LIST_HEAD(list); |
||||
+} |
||||
+ |
||||
/* TODO: merge iter helpers and clean them up, so we can use them here */ |
||||
static int exec_iface_op(int op, int do_show, int info_level, |
||||
struct iface_rec *iface, uint64_t host_no, |
||||
@@ -2319,6 +2402,8 @@ static int exec_iface_op(int op, int do_show, int info_level, |
||||
struct host_info hinfo; |
||||
struct node_rec *rec = NULL; |
||||
int rc = 0; |
||||
+ LIST_HEAD(vlan_params); |
||||
+ struct iscsi_transport *t; |
||||
|
||||
switch (op) { |
||||
case OP_NEW: |
||||
@@ -2381,36 +2466,27 @@ delete_fail: |
||||
rec = idbm_create_rec(NULL, -1, NULL, -1, iface, 1); |
||||
if (!rec) { |
||||
rc = ISCSI_ERR_INVAL; |
||||
- goto update_fail; |
||||
+ break; |
||||
} |
||||
- |
||||
- if (iscsi_check_for_running_session(rec)) |
||||
- log_warning("Updating iface while iscsi sessions " |
||||
- "are using it. You must logout the running " |
||||
- "sessions then log back in for the " |
||||
- "new settings to take affect."); |
||||
- |
||||
- rc = verify_iface_params(params, rec); |
||||
- if (rc) |
||||
+ t = iscsi_sysfs_get_transport_by_name(rec->iface.transport_name); |
||||
+ if (!t) { |
||||
+ log_error("Cound not locate transport for iface %s", iface->name); |
||||
+ rc = ISCSI_ERR_INVAL; |
||||
break; |
||||
- |
||||
- /* pass rec's iface because it has the db values */ |
||||
- rc = iface_conf_update(params, &rec->iface); |
||||
- if (rc) |
||||
- goto update_fail; |
||||
- |
||||
- rc = __for_each_matched_rec(0, rec, params, |
||||
- idbm_node_set_param); |
||||
- if (rc == ISCSI_ERR_NO_OBJS_FOUND) |
||||
- rc = 0; |
||||
- else if (rc) |
||||
- goto update_fail; |
||||
- |
||||
- printf("%s updated.\n", iface->name); |
||||
- break; |
||||
-update_fail: |
||||
- log_error("Could not update iface %s: %s", |
||||
- iface->name, iscsi_err_to_str(rc)); |
||||
+ } |
||||
+ if (t->template->sync_vlan_settings) { |
||||
+ /* sync shared vlan settings across ifaces */ |
||||
+ int nr_found = 0; |
||||
+ struct iface_param_sync sync_params = { |
||||
+ .primary = &rec->iface, |
||||
+ .params = &vlan_params, |
||||
+ .count = 0, |
||||
+ }; |
||||
+ split_vlan_params(params, &vlan_params); |
||||
+ iface_for_each_iface(&sync_params, 1, &nr_found, update_sync_params); |
||||
+ } |
||||
+ iface_param_update(&rec->iface, params); |
||||
+ list_splice_tail(&vlan_params, params); |
||||
break; |
||||
case OP_APPLY: |
||||
if (!iface) { |
||||
diff --git a/usr/transport.c b/usr/transport.c |
||||
index 3b7a00a2245e..35a8ccd4a400 100644 |
||||
--- a/usr/transport.c |
||||
+++ b/usr/transport.c |
||||
@@ -91,6 +91,7 @@ struct iscsi_transport_template bnx2i = { |
||||
struct iscsi_transport_template be2iscsi = { |
||||
.name = "be2iscsi", |
||||
.bind_ep_required = 1, |
||||
+ .sync_vlan_settings = 1, |
||||
.create_conn = be2iscsi_create_conn, |
||||
.ep_connect = ktransport_ep_connect, |
||||
.ep_poll = ktransport_ep_poll, |
||||
diff --git a/usr/transport.h b/usr/transport.h |
||||
index b67776b47288..07027564e46b 100644 |
||||
--- a/usr/transport.h |
||||
+++ b/usr/transport.h |
||||
@@ -40,6 +40,9 @@ struct iscsi_transport_template { |
||||
uint8_t use_boot_info; |
||||
uint8_t bind_ep_required; |
||||
uint8_t no_netdev; |
||||
+ /* be2iscsi has a single host vlan setting, |
||||
+ * but uses 2 ifaces for ipv4 and ipv6 settings; keep them in sync */ |
||||
+ uint8_t sync_vlan_settings; |
||||
int (*ep_connect) (struct iscsi_conn *conn, int non_blocking); |
||||
int (*ep_poll) (struct iscsi_conn *conn, int timeout_ms); |
||||
void (*ep_disconnect) (struct iscsi_conn *conn); |
@ -0,0 +1,2 @@
@@ -0,0 +1,2 @@
|
||||
d /run/lock/iscsi 0700 root root - |
||||
f /run/lock/iscsi/lock 0600 root root - |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
From d6fdb1478fbee4abb45df12868b1c91ad295971d Mon Sep 17 00:00:00 2001 |
||||
From: Lee Duncan <lduncan@suse.com> |
||||
Date: Wed, 1 Apr 2015 10:23:56 -0700 |
||||
Subject: [PATCH v2 2/9] ARP table too small when switches involved. |
||||
|
||||
The default uIP approach is to hae a super-small |
||||
memory foot print, but modern networks, with |
||||
switches, need more than 8 ARP entries, discovered |
||||
during IPv6 using, showing up as slow iscsiuio |
||||
response. |
||||
--- |
||||
iscsiuio/src/uip/ipv6.h | 2 +- |
||||
iscsiuio/src/uip/uipopt.h | 2 +- |
||||
2 files changed, 2 insertions(+), 2 deletions(-) |
||||
|
||||
diff --git a/iscsiuio/src/uip/ipv6.h b/iscsiuio/src/uip/ipv6.h |
||||
index bc63762..3586437 100644 |
||||
--- a/iscsiuio/src/uip/ipv6.h |
||||
+++ b/iscsiuio/src/uip/ipv6.h |
||||
@@ -270,7 +270,7 @@ struct ipv6_context { |
||||
struct ipv6_addr default_router; |
||||
struct ipv6_prefix_entry *addr_list; |
||||
u8_t hop_limit; |
||||
-#define UIP_ARPTAB_SIZE 8 |
||||
+#define UIP_ARPTAB_SIZE 16 |
||||
|
||||
struct uip_stack *ustack; |
||||
#define MAX_MCADDR_TABLE 5 |
||||
diff --git a/iscsiuio/src/uip/uipopt.h b/iscsiuio/src/uip/uipopt.h |
||||
index 946fce2..bcc8949 100644 |
||||
--- a/iscsiuio/src/uip/uipopt.h |
||||
+++ b/iscsiuio/src/uip/uipopt.h |
||||
@@ -341,7 +341,7 @@ |
||||
#ifdef UIP_CONF_ARPTAB_SIZE |
||||
#define UIP_ARPTAB_SIZE UIP_CONF_ARPTAB_SIZE |
||||
#else |
||||
-#define UIP_ARPTAB_SIZE 8 |
||||
+#define UIP_ARPTAB_SIZE 16 |
||||
#endif |
||||
|
||||
/** |
||||
-- |
||||
2.5.5 |
||||
|
@ -0,0 +1,96 @@
@@ -0,0 +1,96 @@
|
||||
From 42b0b82a5dfd15966e8820a99d95c321d685d172 Mon Sep 17 00:00:00 2001 |
||||
From: Christian Seiler <christian.iscsi@gmail.com> |
||||
Date: Sat, 13 Feb 2016 01:05:33 +0100 |
||||
Subject: [PATCH v2 3/9] Build system: sort object file lists |
||||
|
||||
Hi, |
||||
|
||||
Debian is currently working on making the entire archive build |
||||
reproducibly. <https://reproducible-builds.org/> is a good |
||||
resource describing the motivation behind this effort. |
||||
|
||||
There was one problem that was found in the open-iscsi package |
||||
build system that prevented builds from being reproducible: |
||||
the list of object files generated by the wildcard Makefile |
||||
function are not in a deterministic order, causing changes in |
||||
the output depending on the order in the underlying filesystem. |
||||
|
||||
I've attached a patch against the current git master that |
||||
sorts the list of object files within the Makefile, making the |
||||
order deterministic and allowing reproducible builds to be |
||||
made. See also: |
||||
<https://reproducible-builds.org/docs/stable-inputs/> |
||||
|
||||
It would be great if you could apply this patch upstream, so we |
||||
don't have to carry it in Debian. |
||||
|
||||
Thanks! |
||||
|
||||
Regards, |
||||
Christian |
||||
|
||||
-- |
||||
You received this message because you are subscribed to the Google Groups "open-iscsi" group. |
||||
To unsubscribe from this group and stop receiving emails from it, send an email to open-iscsi+unsubscribe@googlegroups.com. |
||||
To post to this group, send email to open-iscsi@googlegroups.com. |
||||
Visit this group at https://groups.google.com/group/open-iscsi. |
||||
For more options, visit https://groups.google.com/d/optout. |
||||
|
||||
From a919d214d10870a54c6a5e383a19a6e82e5f8a54 Mon Sep 17 00:00:00 2001 |
||||
From: Christian Seiler <christian@iwakd.de> |
||||
Date: Sat, 13 Feb 2016 00:56:19 +0100 |
||||
Subject: [PATCH] Build system: sort object file lists |
||||
|
||||
The object file list generated by the wildcard Makefile function is not |
||||
deterministic, because it may change depending on the underlying file |
||||
system. |
||||
|
||||
Use the sort function to make the list deterministic in these cases, to |
||||
be able to build open-iscsi deterministically. See |
||||
<https://reproducible-builds.org/> |
||||
for further details. |
||||
|
||||
Signed-off-by: Christian Seiler <christian@iwakd.de> |
||||
--- |
||||
usr/Makefile | 4 ++-- |
||||
utils/fwparam_ibft/Makefile | 2 +- |
||||
2 files changed, 3 insertions(+), 3 deletions(-) |
||||
|
||||
diff --git a/usr/Makefile b/usr/Makefile |
||||
index 5ac0726..277ac6a 100644 |
||||
--- a/usr/Makefile |
||||
+++ b/usr/Makefile |
||||
@@ -34,7 +34,7 @@ CFLAGS += $(WARNFLAGS) -I../include -I. -D$(OSNAME) $(IPC_CFLAGS) |
||||
PROGRAMS = iscsid iscsiadm iscsistart |
||||
|
||||
# libc compat files |
||||
-SYSDEPS_SRCS = $(wildcard ../utils/sysdeps/*.o) |
||||
+SYSDEPS_SRCS = $(sort $(wildcard ../utils/sysdeps/*.o)) |
||||
# sources shared between iscsid, iscsiadm and iscsistart |
||||
ISCSI_LIB_SRCS = iscsi_util.o io.o auth.o iscsi_timer.o login.o log.o md5.o \ |
||||
sha1.o iface.o idbm.o sysfs.o host.o session_info.o iscsi_sysfs.o \ |
||||
@@ -45,7 +45,7 @@ ISCSI_LIB_SRCS = iscsi_util.o io.o auth.o iscsi_timer.o login.o log.o md5.o \ |
||||
INITIATOR_SRCS = initiator.o scsi.o actor.o event_poll.o mgmt_ipc.o kern_err_table.o |
||||
|
||||
# fw boot files |
||||
-FW_BOOT_SRCS = $(wildcard ../utils/fwparam_ibft/*.o) |
||||
+FW_BOOT_SRCS = $(sort $(wildcard ../utils/fwparam_ibft/*.o)) |
||||
|
||||
# core discovery files |
||||
DISCOVERY_SRCS = $(FW_BOOT_SRCS) strings.o discovery.o |
||||
diff --git a/utils/fwparam_ibft/Makefile b/utils/fwparam_ibft/Makefile |
||||
index 773d8eb..ade8a56 100644 |
||||
--- a/utils/fwparam_ibft/Makefile |
||||
+++ b/utils/fwparam_ibft/Makefile |
||||
@@ -21,7 +21,7 @@ |
||||
# "Prasanna Mumbai" <mumbai.prasanna@gmail.com> |
||||
# |
||||
|
||||
-SYSDEPS_OBJS = $(wildcard ../sysdeps/*.o) |
||||
+SYSDEPS_OBJS = $(sort $(wildcard ../sysdeps/*.o)) |
||||
OBJS := fw_entry.o fwparam_sysfs.o $(SYSDEPS_OBJS) ../../usr/iscsi_net_util.o |
||||
OBJS += prom_lex.o prom_parse.tab.o fwparam_ppc.o |
||||
CLEANFILES = $(OBJS) *.output *~ |
||||
-- |
||||
2.5.5 |
||||
|
@ -0,0 +1,50 @@
@@ -0,0 +1,50 @@
|
||||
From b104afd497502321765c2c1ed3f020b1fe4b400a Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Mon, 29 Feb 2016 14:13:27 -0800 |
||||
Subject: [PATCH v2 4/9] iscsi_tcp set SO_LINGER to abort connection for error |
||||
handling |
||||
|
||||
When requests are being failed it's important to abort the TCP |
||||
connection rather than let TCP wait and attempt a graceful shutdown. |
||||
|
||||
That can be accomplished by setting the SO_LINGER socket option with a |
||||
linger time of 0 to drop queued data and close the connection with a RST |
||||
instead of a FIN. |
||||
|
||||
Signed-off-by: Chris Leech <cleech@redhat.com> |
||||
--- |
||||
usr/io.c | 15 +++++++++++++++ |
||||
1 file changed, 15 insertions(+) |
||||
|
||||
diff --git a/usr/io.c b/usr/io.c |
||||
index f552e1e..48b233c 100644 |
||||
--- a/usr/io.c |
||||
+++ b/usr/io.c |
||||
@@ -391,9 +391,24 @@ iscsi_io_tcp_poll(iscsi_conn_t *conn, int timeout_ms) |
||||
void |
||||
iscsi_io_tcp_disconnect(iscsi_conn_t *conn) |
||||
{ |
||||
+ struct linger so_linger = { .l_onoff = 1, .l_linger = 0 }; |
||||
+ |
||||
if (conn->socket_fd >= 0) { |
||||
log_debug(1, "disconnecting conn %p, fd %d", conn, |
||||
conn->socket_fd); |
||||
+ |
||||
+ /* If the state is not IN_LOGOUT, this isn't a clean shutdown |
||||
+ * and there's some sort of error handling going on. In that |
||||
+ * case, set a 0 SO_LINGER to force an abortive close (RST) and |
||||
+ * free whatever is sitting in the TCP transmit queue. This is |
||||
+ * done to prevent stale data from being sent should the |
||||
+ * network connection be restored before TCP times out. |
||||
+ */ |
||||
+ if (conn->state != ISCSI_CONN_STATE_IN_LOGOUT) { |
||||
+ setsockopt(conn->socket_fd, SOL_SOCKET, SO_LINGER, |
||||
+ &so_linger, sizeof(so_linger)); |
||||
+ } |
||||
+ |
||||
close(conn->socket_fd); |
||||
conn->socket_fd = -1; |
||||
} |
||||
-- |
||||
2.5.5 |
||||
|
@ -0,0 +1,88 @@
@@ -0,0 +1,88 @@
|
||||
From bc5de4146b18cc6359a337c2cc044d136421c215 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Fri, 8 Apr 2016 10:55:46 -0700 |
||||
Subject: [PATCH v2 5/9] iscsiadm: fix parallel rescan handling of exit codes |
||||
|
||||
The parallel rescan patches work, in so much as the rescans happen, but |
||||
if a target is specified the non-matching cases cause warning to be |
||||
printed and a non-zero exit code. |
||||
|
||||
To reproduce: have more than one session to different targets, issue a |
||||
node mode rescan command to one of them (-m node -T <iqn.target> -R). |
||||
|
||||
The problem is that while exit() takes an int, only the low byte is part |
||||
of the exit code and it's combined with other exit status information. |
||||
iscsiadm tries to use exit(-1) to indicate a non-match (not a fatal |
||||
error). The value retrieved with wait() after an exit(-1) is actually |
||||
65280. |
||||
|
||||
Fix this by making use of the wait.h macros for checking the exit code. |
||||
--- |
||||
include/iscsi_err.h | 2 ++ |
||||
usr/iscsi_err.c | 1 + |
||||
usr/iscsi_sysfs.c | 20 +++++++++++++++++--- |
||||
3 files changed, 20 insertions(+), 3 deletions(-) |
||||
|
||||
diff --git a/include/iscsi_err.h b/include/iscsi_err.h |
||||
index 125f443..506bd8c 100644 |
||||
--- a/include/iscsi_err.h |
||||
+++ b/include/iscsi_err.h |
||||
@@ -66,6 +66,8 @@ enum { |
||||
ISCSI_ERR_AGAIN = 29, |
||||
/* unknown discovery type */ |
||||
ISCSI_ERR_UNKNOWN_DISCOVERY_TYPE = 30, |
||||
+ /* child process terminated */ |
||||
+ ISCSI_ERR_CHILD_TERMINATED = 31, |
||||
|
||||
/* Always last. Indicates end of error code space */ |
||||
ISCSI_MAX_ERR_VAL, |
||||
diff --git a/usr/iscsi_err.c b/usr/iscsi_err.c |
||||
index 11e0348..1ba9e64 100644 |
||||
--- a/usr/iscsi_err.c |
||||
+++ b/usr/iscsi_err.c |
||||
@@ -53,6 +53,7 @@ static char *iscsi_err_msgs[] = { |
||||
/* 28 */ "device or resource in use", |
||||
/* 29 */ "operation failed but retry may succeed", |
||||
/* 30 */ "unknown discovery type", |
||||
+ /* 31 */ "child process terminated", |
||||
}; |
||||
|
||||
char *iscsi_err_to_str(int err) |
||||
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c |
||||
index 3a37a48..a8fe156 100644 |
||||
--- a/usr/iscsi_sysfs.c |
||||
+++ b/usr/iscsi_sysfs.c |
||||
@@ -1472,13 +1472,27 @@ int iscsi_sysfs_for_each_session(void *data, int *nr_found, |
||||
break; |
||||
} |
||||
|
||||
- if ((chldrc > 0) && (rc == 0)) { |
||||
+ if (!WIFEXITED(chldrc)) { |
||||
/* |
||||
+ * abnormal termination (signal, exception, etc.) |
||||
+ * |
||||
* The non-parallel code path returns the first |
||||
* error so this keeps the same semantics. |
||||
*/ |
||||
- rc = chldrc; |
||||
- } else if (chldrc == 0) { |
||||
+ if (rc == 0) |
||||
+ rc = ISCSI_ERR_CHILD_TERMINATED; |
||||
+ } else if ((WEXITSTATUS(chldrc) != 0) && |
||||
+ (WEXITSTATUS(chldrc) != 255)) { |
||||
+ /* |
||||
+ * 0 is success |
||||
+ * 255 is a truncated return code from exit(-1) |
||||
+ * and means no match |
||||
+ * anything else (this case) is an error |
||||
+ */ |
||||
+ if (rc == 0) |
||||
+ rc = WEXITSTATUS(chldrc); |
||||
+ } else if (WEXITSTATUS(chldrc) == 0) { |
||||
+ /* success */ |
||||
(*nr_found)++; |
||||
} |
||||
} |
||||
-- |
||||
2.5.5 |
||||
|
@ -0,0 +1,199 @@
@@ -0,0 +1,199 @@
|
||||
From bea3e68d7a242ff50714332598fabaf4975712a2 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Wed, 17 Jun 2015 15:07:53 -0700 |
||||
Subject: [PATCH v2 6/9] iscsistart: support booting over a VLAN |
||||
|
||||
Adds code to check for VLAN devices if the boot configuration specifies |
||||
a VLAN ID. |
||||
|
||||
Does not create VLANs, they need to already be in place. |
||||
--- |
||||
include/iscsi_net_util.h | 3 +- |
||||
usr/iscsi_net_util.c | 78 +++++++++++++++++++++++++++++++++++++++++-- |
||||
utils/fwparam_ibft/fw_entry.c | 3 +- |
||||
3 files changed, 78 insertions(+), 6 deletions(-) |
||||
|
||||
diff --git a/include/iscsi_net_util.h b/include/iscsi_net_util.h |
||||
index 31b80ad..cbf3637 100644 |
||||
--- a/include/iscsi_net_util.h |
||||
+++ b/include/iscsi_net_util.h |
||||
@@ -6,7 +6,8 @@ |
||||
extern int net_get_transport_name_from_netdev(char *netdev, char *transport); |
||||
extern int net_get_netdev_from_hwaddress(char *hwaddress, char *netdev); |
||||
extern int net_setup_netdev(char *netdev, char *local_ip, char *mask, |
||||
- char *gateway, char *remote_ip, int needs_bringup); |
||||
+ char *gateway, char *vlan, char *remote_ip, |
||||
+ int needs_bringup); |
||||
extern int net_ifup_netdev(char *netdev); |
||||
|
||||
#endif |
||||
diff --git a/usr/iscsi_net_util.c b/usr/iscsi_net_util.c |
||||
index 848b4c6..06df9b3 100644 |
||||
--- a/usr/iscsi_net_util.c |
||||
+++ b/usr/iscsi_net_util.c |
||||
@@ -19,6 +19,7 @@ |
||||
#include <errno.h> |
||||
#include <net/if.h> |
||||
#include <unistd.h> |
||||
+#include <stdlib.h> |
||||
#include <netinet/in.h> |
||||
#include <arpa/inet.h> |
||||
#include <net/route.h> |
||||
@@ -27,6 +28,9 @@ |
||||
#include <sys/ioctl.h> |
||||
#include <sys/socket.h> |
||||
#include <linux/sockios.h> |
||||
+#include <linux/if_vlan.h> |
||||
+#include <net/if_arp.h> |
||||
+#include <linux/if_ether.h> |
||||
|
||||
#include "sysdeps.h" |
||||
#include "ethtool-copy.h" |
||||
@@ -162,6 +166,45 @@ free_ifni: |
||||
return 0; |
||||
} |
||||
|
||||
+static char *find_vlan_dev(char *netdev, int vlan_id) { |
||||
+ struct ifreq if_hwaddr; |
||||
+ struct ifreq vlan_hwaddr; |
||||
+ struct vlan_ioctl_args vlanrq = { .cmd = GET_VLAN_VID_CMD, }; |
||||
+ struct if_nameindex *ifni; |
||||
+ char *vlan = NULL; |
||||
+ int sockfd, i, rc; |
||||
+ |
||||
+ sockfd = socket(AF_INET, SOCK_DGRAM, 0); |
||||
+ |
||||
+ strncpy(if_hwaddr.ifr_name, netdev, IFNAMSIZ); |
||||
+ ioctl(sockfd, SIOCGIFHWADDR, &if_hwaddr); |
||||
+ |
||||
+ if (if_hwaddr.ifr_hwaddr.sa_family != ARPHRD_ETHER) |
||||
+ return NULL; |
||||
+ |
||||
+ ifni = if_nameindex(); |
||||
+ for (i = 0; ifni[i].if_index && ifni[i].if_name; i++) { |
||||
+ strncpy(vlan_hwaddr.ifr_name, ifni[i].if_name, IFNAMSIZ); |
||||
+ ioctl(sockfd, SIOCGIFHWADDR, &vlan_hwaddr); |
||||
+ |
||||
+ if (vlan_hwaddr.ifr_hwaddr.sa_family != ARPHRD_ETHER) |
||||
+ continue; |
||||
+ |
||||
+ if (!memcmp(if_hwaddr.ifr_hwaddr.sa_data, vlan_hwaddr.ifr_hwaddr.sa_data, ETH_ALEN)) { |
||||
+ strncpy(vlanrq.device1, ifni[i].if_name, IFNAMSIZ); |
||||
+ rc = ioctl(sockfd, SIOCGIFVLAN, &vlanrq); |
||||
+ if ((rc == 0) && (vlanrq.u.VID == vlan_id)) { |
||||
+ vlan = strdup(vlanrq.device1); |
||||
+ break; |
||||
+ } |
||||
+ } |
||||
+ } |
||||
+ if_freenameindex(ifni); |
||||
+ |
||||
+ close(sockfd); |
||||
+ return vlan; |
||||
+} |
||||
+ |
||||
/** |
||||
* net_setup_netdev - bring up NIC |
||||
* @netdev: network device name |
||||
@@ -175,7 +218,7 @@ free_ifni: |
||||
* to force iSCSI traffic through correct NIC. |
||||
*/ |
||||
int net_setup_netdev(char *netdev, char *local_ip, char *mask, char *gateway, |
||||
- char *remote_ip, int needs_bringup) |
||||
+ char *vlan, char *remote_ip, int needs_bringup) |
||||
{ |
||||
struct sockaddr_in sk_ipaddr = { .sin_family = AF_INET }; |
||||
struct sockaddr_in sk_netmask = { .sin_family = AF_INET }; |
||||
@@ -184,14 +227,29 @@ int net_setup_netdev(char *netdev, char *local_ip, char *mask, char *gateway, |
||||
struct sockaddr_in sk_tgt_ipaddr = { .sin_family = AF_INET }; |
||||
struct rtentry rt; |
||||
struct ifreq ifr; |
||||
+ char *physdev = NULL; |
||||
int sock; |
||||
int ret; |
||||
+ int vlan_id; |
||||
|
||||
if (!strlen(netdev)) { |
||||
log_error("No netdev name in fw entry."); |
||||
return EINVAL; |
||||
} |
||||
|
||||
+ vlan_id = atoi(vlan); |
||||
+ |
||||
+ if (vlan_id != 0) { |
||||
+ physdev = netdev; |
||||
+ netdev = find_vlan_dev(physdev, vlan_id); |
||||
+ } |
||||
+ |
||||
+ if (vlan_id && !netdev) { |
||||
+ /* TODO: create vlan if not found */ |
||||
+ log_error("No matching vlan found for fw entry."); |
||||
+ return EINVAL; |
||||
+ } |
||||
+ |
||||
/* Create socket for making networking changes */ |
||||
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1) { |
||||
log_error("Could not open socket to manage network " |
||||
@@ -224,7 +282,19 @@ int net_setup_netdev(char *netdev, char *local_ip, char *mask, char *gateway, |
||||
|
||||
/* Only set IP/NM if this is a new interface */ |
||||
if (needs_bringup) { |
||||
- /* TODO: create vlan if strlen(vlan) */ |
||||
+ |
||||
+ if (physdev) { |
||||
+ /* Bring up interface */ |
||||
+ memset(&ifr, 0, sizeof(ifr)); |
||||
+ strlcpy(ifr.ifr_name, physdev, IFNAMSIZ); |
||||
+ ifr.ifr_flags = IFF_UP | IFF_RUNNING; |
||||
+ if (ioctl(sock, SIOCSIFFLAGS, &ifr) < 0) { |
||||
+ log_error("Could not bring up netdev %s (err %d - %s)", |
||||
+ physdev, errno, strerror(errno)); |
||||
+ ret = errno; |
||||
+ goto done; |
||||
+ } |
||||
+ } |
||||
|
||||
/* Bring up interface */ |
||||
memset(&ifr, 0, sizeof(ifr)); |
||||
@@ -246,7 +316,7 @@ int net_setup_netdev(char *netdev, char *local_ip, char *mask, char *gateway, |
||||
ret = errno; |
||||
goto done; |
||||
} |
||||
- |
||||
+ |
||||
/* Set netmask */ |
||||
memset(&ifr, 0, sizeof(ifr)); |
||||
strlcpy(ifr.ifr_name, netdev, IFNAMSIZ); |
||||
@@ -303,6 +373,8 @@ int net_setup_netdev(char *netdev, char *local_ip, char *mask, char *gateway, |
||||
|
||||
done: |
||||
close(sock); |
||||
+ if (vlan_id) |
||||
+ free(netdev); |
||||
return ret; |
||||
} |
||||
|
||||
diff --git a/utils/fwparam_ibft/fw_entry.c b/utils/fwparam_ibft/fw_entry.c |
||||
index f94a035..0a1b46b 100644 |
||||
--- a/utils/fwparam_ibft/fw_entry.c |
||||
+++ b/utils/fwparam_ibft/fw_entry.c |
||||
@@ -41,8 +41,6 @@ |
||||
/** |
||||
* fw_setup_nics - setup nics (ethXs) based on ibft net info |
||||
* |
||||
- * Currently does not support vlans. |
||||
- * |
||||
* If this is a offload card, this function does nothing. The |
||||
* net info is used by the iscsi iface settings for the iscsi |
||||
* function. |
||||
@@ -82,6 +80,7 @@ int fw_setup_nics(void) |
||||
|
||||
err = net_setup_netdev(context->iface, context->ipaddr, |
||||
context->mask, context->gateway, |
||||
+ context->vlan, |
||||
context->target_ipaddr, needs_bringup); |
||||
if (err) |
||||
ret = err; |
||||
-- |
||||
2.5.5 |
||||
|
@ -0,0 +1,51 @@
@@ -0,0 +1,51 @@
|
||||
From 3f1b9160dc8ffc6e7196a24885781e1ba82f9119 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Tue, 21 Jul 2015 16:15:30 -0700 |
||||
Subject: [PATCH v2 7/9] iscsid: safe_logout fix device path canonicalization |
||||
by using libmount cache |
||||
|
||||
Fix for the safe_logout options use of libmount. If the cache API isn't |
||||
used then device name canonicalization doesn't happen, and proper |
||||
detection of devices mounted by a label doesn't work. |
||||
--- |
||||
usr/initiator.c | 9 +++++++-- |
||||
1 file changed, 7 insertions(+), 2 deletions(-) |
||||
|
||||
diff --git a/usr/initiator.c b/usr/initiator.c |
||||
index 8cd1896..b0f0147 100644 |
||||
--- a/usr/initiator.c |
||||
+++ b/usr/initiator.c |
||||
@@ -2045,12 +2045,14 @@ static int session_unbind(struct iscsi_session *session) |
||||
} |
||||
|
||||
static struct libmnt_table *mtab, *swaps; |
||||
+static struct libmnt_cache *mntcache; |
||||
|
||||
static void libmount_cleanup(void) |
||||
{ |
||||
mnt_free_table(mtab); |
||||
mnt_free_table(swaps); |
||||
- mtab = swaps = NULL; |
||||
+ mnt_free_cache(mntcache); |
||||
+ mtab = swaps = mntcache = NULL; |
||||
} |
||||
|
||||
static int libmount_init(void) |
||||
@@ -2058,10 +2060,13 @@ static int libmount_init(void) |
||||
mnt_init_debug(0); |
||||
mtab = mnt_new_table(); |
||||
swaps = mnt_new_table(); |
||||
- if (!mtab || !swaps) { |
||||
+ mntcache = mnt_new_cache(); |
||||
+ if (!mtab || !swaps || !mntcache) { |
||||
libmount_cleanup(); |
||||
return -ENOMEM; |
||||
} |
||||
+ mnt_table_set_cache(mtab, mntcache); |
||||
+ mnt_table_set_cache(swaps, mntcache); |
||||
mnt_table_parse_mtab(mtab, NULL); |
||||
mnt_table_parse_swaps(swaps, NULL); |
||||
return 0; |
||||
-- |
||||
2.5.5 |
||||
|
@ -0,0 +1,573 @@
@@ -0,0 +1,573 @@
|
||||
From 723e7b342ec311a59f92eb94936ce769e804b43d Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Fri, 24 Jul 2015 14:18:30 -0700 |
||||
Subject: [PATCH v2 8/9] iscsid: make safe_logut session checks apply for |
||||
flashnode session |
||||
|
||||
Make the safe_logout option work with flashnode sessions as well. |
||||
Moves the code into a new file shared between iscsid and iscsiadm. |
||||
--- |
||||
usr/Makefile | 8 +- |
||||
usr/initiator.c | 195 ----------------------------------------- |
||||
usr/initiator.h | 1 + |
||||
usr/initiator_common.c | 2 + |
||||
usr/iscsiadm.c | 23 +++++ |
||||
usr/iscsistart.c | 2 + |
||||
usr/mntcheck.c | 233 +++++++++++++++++++++++++++++++++++++++++++++++++ |
||||
7 files changed, 265 insertions(+), 199 deletions(-) |
||||
create mode 100644 usr/mntcheck.c |
||||
|
||||
diff --git a/usr/Makefile b/usr/Makefile |
||||
index 277ac6a..c1866b6 100644 |
||||
--- a/usr/Makefile |
||||
+++ b/usr/Makefile |
||||
@@ -53,15 +53,15 @@ DISCOVERY_SRCS = $(FW_BOOT_SRCS) strings.o discovery.o |
||||
all: $(PROGRAMS) |
||||
|
||||
iscsid: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(DISCOVERY_SRCS) \ |
||||
- iscsid.o session_mgmt.o discoveryd.o |
||||
+ iscsid.o session_mgmt.o discoveryd.o mntcheck.o |
||||
$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -lisns -lcrypto -lrt -lmount |
||||
|
||||
-iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_SRCS) iscsiadm.o session_mgmt.o |
||||
- $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -lisns -lcrypto |
||||
+iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_SRCS) iscsiadm.o session_mgmt.o mntcheck.o |
||||
+ $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -lisns -lcrypto -lmount |
||||
|
||||
iscsistart: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \ |
||||
iscsistart.o statics.o |
||||
- $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -lrt -lmount |
||||
+ $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -lrt |
||||
clean: |
||||
rm -f *.o $(PROGRAMS) .depend $(LIBSYS) |
||||
|
||||
diff --git a/usr/initiator.c b/usr/initiator.c |
||||
index b0f0147..072bcc9 100644 |
||||
--- a/usr/initiator.c |
||||
+++ b/usr/initiator.c |
||||
@@ -30,7 +30,6 @@ |
||||
#include <errno.h> |
||||
#include <dirent.h> |
||||
#include <fcntl.h> |
||||
-#include <libmount/libmount.h> |
||||
|
||||
#include "initiator.h" |
||||
#include "transport.h" |
||||
@@ -2044,200 +2043,6 @@ static int session_unbind(struct iscsi_session *session) |
||||
return err; |
||||
} |
||||
|
||||
-static struct libmnt_table *mtab, *swaps; |
||||
-static struct libmnt_cache *mntcache; |
||||
- |
||||
-static void libmount_cleanup(void) |
||||
-{ |
||||
- mnt_free_table(mtab); |
||||
- mnt_free_table(swaps); |
||||
- mnt_free_cache(mntcache); |
||||
- mtab = swaps = mntcache = NULL; |
||||
-} |
||||
- |
||||
-static int libmount_init(void) |
||||
-{ |
||||
- mnt_init_debug(0); |
||||
- mtab = mnt_new_table(); |
||||
- swaps = mnt_new_table(); |
||||
- mntcache = mnt_new_cache(); |
||||
- if (!mtab || !swaps || !mntcache) { |
||||
- libmount_cleanup(); |
||||
- return -ENOMEM; |
||||
- } |
||||
- mnt_table_set_cache(mtab, mntcache); |
||||
- mnt_table_set_cache(swaps, mntcache); |
||||
- mnt_table_parse_mtab(mtab, NULL); |
||||
- mnt_table_parse_swaps(swaps, NULL); |
||||
- return 0; |
||||
-} |
||||
- |
||||
-static int trans_filter(const struct dirent *d) |
||||
-{ |
||||
- if (!strcmp(".", d->d_name) || !strcmp("..", d->d_name)) |
||||
- return 0; |
||||
- return 1; |
||||
-} |
||||
- |
||||
-static int subdir_filter(const struct dirent *d) |
||||
-{ |
||||
- if (!(d->d_type & DT_DIR)) |
||||
- return 0; |
||||
- return trans_filter(d); |
||||
-} |
||||
- |
||||
-static int is_partition(const char *path) |
||||
-{ |
||||
- char *devtype; |
||||
- int rc = 0; |
||||
- |
||||
- devtype = sysfs_get_uevent_devtype(path); |
||||
- if (!devtype) |
||||
- return 0; |
||||
- if (strcmp(devtype, "partition") == 0) |
||||
- rc = 1; |
||||
- free(devtype); |
||||
- return rc; |
||||
-} |
||||
- |
||||
-static int blockdev_check_mnts(char *syspath) |
||||
-{ |
||||
- struct libmnt_fs *fs; |
||||
- char *devname = NULL; |
||||
- char *_devname = NULL; |
||||
- int rc = 0; |
||||
- |
||||
- devname = sysfs_get_uevent_devname(syspath); |
||||
- if (!devname) |
||||
- goto out; |
||||
- |
||||
- _devname = calloc(1, PATH_MAX); |
||||
- if (!_devname) |
||||
- goto out; |
||||
- snprintf(_devname, PATH_MAX, "/dev/%s", devname); |
||||
- |
||||
- fs = mnt_table_find_source(mtab, _devname, MNT_ITER_FORWARD); |
||||
- if (fs) { |
||||
- rc = 1; |
||||
- goto out; |
||||
- } |
||||
- fs = mnt_table_find_source(swaps, _devname, MNT_ITER_FORWARD); |
||||
- if (fs) |
||||
- rc = 1; |
||||
-out: |
||||
- free(devname); |
||||
- free(_devname); |
||||
- return rc; |
||||
-} |
||||
- |
||||
-static int count_device_users(char *syspath); |
||||
- |
||||
-static int blockdev_get_partitions(char *syspath) |
||||
-{ |
||||
- struct dirent **parts = NULL; |
||||
- int n, i; |
||||
- int count = 0; |
||||
- |
||||
- n = scandir(syspath, &parts, subdir_filter, alphasort); |
||||
- for (i = 0; i < n; i++) { |
||||
- char *newpath; |
||||
- |
||||
- newpath = calloc(1, PATH_MAX); |
||||
- if (!newpath) |
||||
- continue; |
||||
- snprintf(newpath, PATH_MAX, "%s/%s", syspath, parts[i]->d_name); |
||||
- free(parts[i]); |
||||
- if (is_partition(newpath)) { |
||||
- count += count_device_users(newpath); |
||||
- } |
||||
- free(newpath); |
||||
- } |
||||
- free(parts); |
||||
- return count; |
||||
-} |
||||
- |
||||
-static int blockdev_get_holders(char *syspath) |
||||
-{ |
||||
- char *path = NULL; |
||||
- struct dirent **holds = NULL; |
||||
- int n, i; |
||||
- int count = 0; |
||||
- |
||||
- path = calloc(1, PATH_MAX); |
||||
- if (!path) |
||||
- return 0; |
||||
- snprintf(path, PATH_MAX, "%s/holders", syspath); |
||||
- |
||||
- n = scandir(path, &holds, trans_filter, alphasort); |
||||
- for (i = 0; i < n; i++) { |
||||
- char *newpath; |
||||
- char *rp; |
||||
- |
||||
- newpath = calloc(1, PATH_MAX); |
||||
- if (!newpath) |
||||
- continue; |
||||
- snprintf(newpath, PATH_MAX, "%s/%s", path, holds[i]->d_name); |
||||
- |
||||
- free(holds[i]); |
||||
- rp = realpath(newpath, NULL); |
||||
- if (rp) |
||||
- count += count_device_users(rp); |
||||
- free(newpath); |
||||
- free(rp); |
||||
- } |
||||
- free(path); |
||||
- free(holds); |
||||
- return count; |
||||
-} |
||||
- |
||||
-static int count_device_users(char *syspath) |
||||
-{ |
||||
- int count = 0; |
||||
- count += blockdev_check_mnts(syspath); |
||||
- count += blockdev_get_partitions(syspath); |
||||
- count += blockdev_get_holders(syspath); |
||||
- return count; |
||||
-}; |
||||
- |
||||
-static void device_in_use(void *data, int host_no, int target, int lun) |
||||
-{ |
||||
- char *syspath = NULL; |
||||
- char *devname = NULL; |
||||
- int *count = data; |
||||
- |
||||
- devname = iscsi_sysfs_get_blockdev_from_lun(host_no, target, lun); |
||||
- if (!devname) |
||||
- goto out; |
||||
- syspath = calloc(1, PATH_MAX); |
||||
- if (!syspath) |
||||
- goto out; |
||||
- snprintf(syspath, PATH_MAX, "/sys/class/block/%s", devname); |
||||
- *count += count_device_users(syspath); |
||||
-out: |
||||
- free(syspath); |
||||
- free(devname); |
||||
-} |
||||
- |
||||
-static int session_in_use(int sid) |
||||
-{ |
||||
- int host_no = -1, err = 0; |
||||
- int count = 0; |
||||
- |
||||
- if (libmount_init()) { |
||||
- log_error("Failed to initialize libmount, " |
||||
- "not checking for active mounts on session [%d].", |
||||
- sid); |
||||
- return 0; |
||||
- } |
||||
- |
||||
- host_no = iscsi_sysfs_get_host_no_from_sid(sid, &err); |
||||
- if (!err) |
||||
- iscsi_sysfs_for_each_device(&count, host_no, sid, device_in_use); |
||||
- |
||||
- libmount_cleanup(); |
||||
- return count; |
||||
-} |
||||
- |
||||
int session_logout_task(int sid, queue_task_t *qtask) |
||||
{ |
||||
iscsi_session_t *session; |
||||
diff --git a/usr/initiator.h b/usr/initiator.h |
||||
index c11d77f..4f96d6b 100644 |
||||
--- a/usr/initiator.h |
||||
+++ b/usr/initiator.h |
||||
@@ -359,4 +359,5 @@ extern int iscsi_set_net_config(struct iscsi_transport *t, |
||||
struct iface_rec *iface); |
||||
extern void iscsi_session_init_params(struct iscsi_session *session); |
||||
|
||||
+extern int session_in_use(int sid); |
||||
#endif /* INITIATOR_H */ |
||||
diff --git a/usr/initiator_common.c b/usr/initiator_common.c |
||||
index c02643a..1d1d822 100644 |
||||
--- a/usr/initiator_common.c |
||||
+++ b/usr/initiator_common.c |
||||
@@ -23,6 +23,8 @@ |
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include <errno.h> |
||||
+#include <dirent.h> |
||||
+#include <libmount/libmount.h> |
||||
|
||||
#include "initiator.h" |
||||
#include "transport.h" |
||||
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c |
||||
index c6705bd..fc0c8bc 100644 |
||||
--- a/usr/iscsiadm.c |
||||
+++ b/usr/iscsiadm.c |
||||
@@ -1898,11 +1898,34 @@ exit_logout: |
||||
return rc; |
||||
} |
||||
|
||||
+static int iscsi_check_session_use_count(uint32_t sid) { |
||||
+ char *config_file; |
||||
+ char *safe_logout; |
||||
+ |
||||
+ config_file = get_config_file(); |
||||
+ if (!config_file) { |
||||
+ log_error("Could not get config file from iscsid"); |
||||
+ return 0; |
||||
+ } |
||||
+ |
||||
+ safe_logout = cfg_get_string_param(config_file, "iscsid.safe_logout"); |
||||
+ if (!safe_logout || strcmp(safe_logout, "Yes")) |
||||
+ return 0; |
||||
+ |
||||
+ return session_in_use(sid); |
||||
+} |
||||
+ |
||||
int iscsi_logout_flashnode_sid(struct iscsi_transport *t, uint32_t host_no, |
||||
uint32_t sid) |
||||
{ |
||||
int fd, rc = 0; |
||||
|
||||
+ if (iscsi_check_session_use_count(sid)) { |
||||
+ log_error("Session is actively in use for mounted storage, " |
||||
+ "and iscsid.safe_logout is configured."); |
||||
+ return ISCSI_ERR_BUSY; |
||||
+ } |
||||
+ |
||||
fd = ipc->ctldev_open(); |
||||
if (fd < 0) { |
||||
log_error("Netlink open failed."); |
||||
diff --git a/usr/iscsistart.c b/usr/iscsistart.c |
||||
index 7ff2236..79d6622 100644 |
||||
--- a/usr/iscsistart.c |
||||
+++ b/usr/iscsistart.c |
||||
@@ -279,6 +279,8 @@ static int setup_session(void) |
||||
return rc; |
||||
} |
||||
|
||||
+int session_in_use(int sid) { return 0; } |
||||
+ |
||||
static void catch_signal(int signo) |
||||
{ |
||||
log_warning("pid %d caught signal -%d", getpid(), signo); |
||||
diff --git a/usr/mntcheck.c b/usr/mntcheck.c |
||||
new file mode 100644 |
||||
index 0000000..6ae03e0 |
||||
--- /dev/null |
||||
+++ b/usr/mntcheck.c |
||||
@@ -0,0 +1,233 @@ |
||||
+/* |
||||
+ * Common code for checking sessions for mnt use |
||||
+ * |
||||
+ * Copyright (C) 2014 - 2015 Chris Leech |
||||
+ * Copyright (C) 2014 - 2015 Red Hat, Inc. All rights reserved. |
||||
+ * |
||||
+ * This program is free software; you can redistribute it and/or modify |
||||
+ * it under the terms of the GNU General Public License as published |
||||
+ * by the Free Software Foundation; either version 2 of the License, or |
||||
+ * (at your option) any later version. |
||||
+ * |
||||
+ * This program is distributed in the hope that it will be useful, but |
||||
+ * WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||
+ * General Public License for more details. |
||||
+ * |
||||
+ * See the file COPYING included with this distribution for more details. |
||||
+ */ |
||||
+ |
||||
+#include <string.h> |
||||
+#include <stdio.h> |
||||
+#include <stdlib.h> |
||||
+#include <errno.h> |
||||
+#include <dirent.h> |
||||
+#include <libmount/libmount.h> |
||||
+ |
||||
+#include "initiator.h" |
||||
+#include "transport.h" |
||||
+#include "iscsid.h" |
||||
+#include "iscsi_ipc.h" |
||||
+#include "log.h" |
||||
+#include "iscsi_sysfs.h" |
||||
+#include "iscsi_settings.h" |
||||
+#include "iface.h" |
||||
+#include "host.h" |
||||
+#include "sysdeps.h" |
||||
+#include "iscsi_err.h" |
||||
+#include "iscsi_net_util.h" |
||||
+ |
||||
+static struct libmnt_table *mtab, *swaps; |
||||
+static struct libmnt_cache *mntcache; |
||||
+ |
||||
+static void libmount_cleanup(void) |
||||
+{ |
||||
+ mnt_free_table(mtab); |
||||
+ mnt_free_table(swaps); |
||||
+ mnt_free_cache(mntcache); |
||||
+ mtab = NULL; |
||||
+ swaps = NULL; |
||||
+ mntcache = NULL; |
||||
+} |
||||
+ |
||||
+static int libmount_init(void) |
||||
+{ |
||||
+ mnt_init_debug(0); |
||||
+ mtab = mnt_new_table(); |
||||
+ swaps = mnt_new_table(); |
||||
+ mntcache = mnt_new_cache(); |
||||
+ if (!mtab || !swaps || !mntcache) { |
||||
+ libmount_cleanup(); |
||||
+ return -ENOMEM; |
||||
+ } |
||||
+ mnt_table_set_cache(mtab, mntcache); |
||||
+ mnt_table_set_cache(swaps, mntcache); |
||||
+ mnt_table_parse_mtab(mtab, NULL); |
||||
+ mnt_table_parse_swaps(swaps, NULL); |
||||
+ return 0; |
||||
+} |
||||
+ |
||||
+static int trans_filter(const struct dirent *d) |
||||
+{ |
||||
+ if (!strcmp(".", d->d_name) || !strcmp("..", d->d_name)) |
||||
+ return 0; |
||||
+ return 1; |
||||
+} |
||||
+ |
||||
+static int subdir_filter(const struct dirent *d) |
||||
+{ |
||||
+ if (!(d->d_type & DT_DIR)) |
||||
+ return 0; |
||||
+ return trans_filter(d); |
||||
+} |
||||
+ |
||||
+static int is_partition(const char *path) |
||||
+{ |
||||
+ char *devtype; |
||||
+ int rc = 0; |
||||
+ |
||||
+ devtype = sysfs_get_uevent_devtype(path); |
||||
+ if (!devtype) |
||||
+ return 0; |
||||
+ if (strcmp(devtype, "partition") == 0) |
||||
+ rc = 1; |
||||
+ free(devtype); |
||||
+ return rc; |
||||
+} |
||||
+ |
||||
+static int blockdev_check_mnts(char *syspath) |
||||
+{ |
||||
+ struct libmnt_fs *fs; |
||||
+ char *devname = NULL; |
||||
+ char *_devname = NULL; |
||||
+ int rc = 0; |
||||
+ |
||||
+ devname = sysfs_get_uevent_devname(syspath); |
||||
+ if (!devname) |
||||
+ goto out; |
||||
+ |
||||
+ _devname = calloc(1, PATH_MAX); |
||||
+ if (!_devname) |
||||
+ goto out; |
||||
+ snprintf(_devname, PATH_MAX, "/dev/%s", devname); |
||||
+ |
||||
+ fs = mnt_table_find_source(mtab, _devname, MNT_ITER_FORWARD); |
||||
+ if (fs) { |
||||
+ rc = 1; |
||||
+ goto out; |
||||
+ } |
||||
+ fs = mnt_table_find_source(swaps, _devname, MNT_ITER_FORWARD); |
||||
+ if (fs) |
||||
+ rc = 1; |
||||
+out: |
||||
+ free(devname); |
||||
+ free(_devname); |
||||
+ return rc; |
||||
+} |
||||
+ |
||||
+static int count_device_users(char *syspath); |
||||
+ |
||||
+static int blockdev_get_partitions(char *syspath) |
||||
+{ |
||||
+ struct dirent **parts = NULL; |
||||
+ int n, i; |
||||
+ int count = 0; |
||||
+ |
||||
+ n = scandir(syspath, &parts, subdir_filter, alphasort); |
||||
+ for (i = 0; i < n; i++) { |
||||
+ char *newpath; |
||||
+ |
||||
+ newpath = calloc(1, PATH_MAX); |
||||
+ if (!newpath) |
||||
+ continue; |
||||
+ snprintf(newpath, PATH_MAX, "%s/%s", syspath, parts[i]->d_name); |
||||
+ free(parts[i]); |
||||
+ if (is_partition(newpath)) { |
||||
+ count += count_device_users(newpath); |
||||
+ } |
||||
+ free(newpath); |
||||
+ } |
||||
+ free(parts); |
||||
+ return count; |
||||
+} |
||||
+ |
||||
+static int blockdev_get_holders(char *syspath) |
||||
+{ |
||||
+ char *path = NULL; |
||||
+ struct dirent **holds = NULL; |
||||
+ int n, i; |
||||
+ int count = 0; |
||||
+ |
||||
+ path = calloc(1, PATH_MAX); |
||||
+ if (!path) |
||||
+ return 0; |
||||
+ snprintf(path, PATH_MAX, "%s/holders", syspath); |
||||
+ |
||||
+ n = scandir(path, &holds, trans_filter, alphasort); |
||||
+ for (i = 0; i < n; i++) { |
||||
+ char *newpath; |
||||
+ char *rp; |
||||
+ |
||||
+ newpath = calloc(1, PATH_MAX); |
||||
+ if (!newpath) |
||||
+ continue; |
||||
+ snprintf(newpath, PATH_MAX, "%s/%s", path, holds[i]->d_name); |
||||
+ |
||||
+ free(holds[i]); |
||||
+ rp = realpath(newpath, NULL); |
||||
+ if (rp) |
||||
+ count += count_device_users(rp); |
||||
+ free(newpath); |
||||
+ free(rp); |
||||
+ } |
||||
+ free(path); |
||||
+ free(holds); |
||||
+ return count; |
||||
+} |
||||
+ |
||||
+static int count_device_users(char *syspath) |
||||
+{ |
||||
+ int count = 0; |
||||
+ count += blockdev_check_mnts(syspath); |
||||
+ count += blockdev_get_partitions(syspath); |
||||
+ count += blockdev_get_holders(syspath); |
||||
+ return count; |
||||
+}; |
||||
+ |
||||
+static void device_in_use(void *data, int host_no, int target, int lun) |
||||
+{ |
||||
+ char *syspath = NULL; |
||||
+ char *devname = NULL; |
||||
+ int *count = data; |
||||
+ |
||||
+ devname = iscsi_sysfs_get_blockdev_from_lun(host_no, target, lun); |
||||
+ if (!devname) |
||||
+ goto out; |
||||
+ syspath = calloc(1, PATH_MAX); |
||||
+ if (!syspath) |
||||
+ goto out; |
||||
+ snprintf(syspath, PATH_MAX, "/sys/class/block/%s", devname); |
||||
+ *count += count_device_users(syspath); |
||||
+out: |
||||
+ free(syspath); |
||||
+ free(devname); |
||||
+} |
||||
+ |
||||
+int session_in_use(int sid) |
||||
+{ |
||||
+ int host_no = -1, err = 0; |
||||
+ int count = 0; |
||||
+ |
||||
+ if (libmount_init()) { |
||||
+ log_error("Failed to initialize libmount, " |
||||
+ "not checking for active mounts on session [%d].", sid); |
||||
+ return 0; |
||||
+ } |
||||
+ |
||||
+ host_no = iscsi_sysfs_get_host_no_from_sid(sid, &err); |
||||
+ if (!err) |
||||
+ iscsi_sysfs_for_each_device(&count, host_no, sid, device_in_use); |
||||
+ |
||||
+ libmount_cleanup(); |
||||
+ return count; |
||||
+} |
||||
-- |
||||
2.5.5 |
||||
|
@ -0,0 +1,223 @@
@@ -0,0 +1,223 @@
|
||||
From 62b1b734053a33af1aabac663dc52dfce0682904 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Tue, 16 Feb 2016 16:45:26 -0800 |
||||
Subject: [PATCH v2 9/9] remove sysfs attr_list |
||||
|
||||
The global cache is not well designed, it quickly can grow to the point |
||||
where lookups take much longer than just doing the sysfs read in the |
||||
first place. |
||||
|
||||
v2: initialized 'value' array in sysfs_attr_get_value to fix issue when |
||||
checking for an attr that doesn't exist |
||||
|
||||
v3: fix another behavior change when checking ofr non-existent attrs, |
||||
make sure we return NULL and not an empty string |
||||
--- |
||||
usr/host.c | 1 + |
||||
usr/session_info.c | 1 + |
||||
usr/sysfs.c | 65 ++++++++++++++---------------------------------------- |
||||
3 files changed, 19 insertions(+), 48 deletions(-) |
||||
|
||||
diff --git a/usr/host.c b/usr/host.c |
||||
index f2052d3..6333490 100644 |
||||
--- a/usr/host.c |
||||
+++ b/usr/host.c |
||||
@@ -274,6 +274,7 @@ int host_info_print(int info_level, uint32_t host_no) |
||||
printf("iSCSI Transport Class version %s\n", |
||||
version); |
||||
printf("version %s\n", ISCSI_VERSION_STR); |
||||
+ free(version); |
||||
} |
||||
|
||||
flags |= SESSION_INFO_SCSI_DEVS; |
||||
diff --git a/usr/session_info.c b/usr/session_info.c |
||||
index 2f48e65..89422d8 100644 |
||||
--- a/usr/session_info.c |
||||
+++ b/usr/session_info.c |
||||
@@ -390,6 +390,7 @@ int session_info_print(int info_level, struct session_info *info, int do_show) |
||||
printf("iSCSI Transport Class version %s\n", |
||||
version); |
||||
printf("version %s\n", ISCSI_VERSION_STR); |
||||
+ free(version); |
||||
} |
||||
|
||||
flags |= (SESSION_INFO_SCSI_DEVS | SESSION_INFO_HOST_DEVS); |
||||
diff --git a/usr/sysfs.c b/usr/sysfs.c |
||||
index 6520bf6..48f3825 100644 |
||||
--- a/usr/sysfs.c |
||||
+++ b/usr/sysfs.c |
||||
@@ -63,15 +63,6 @@ char sysfs_path[PATH_SIZE]; |
||||
/* device cache */ |
||||
static LIST_HEAD(dev_list); |
||||
|
||||
-/* attribute value cache */ |
||||
-static LIST_HEAD(attr_list); |
||||
- |
||||
-struct sysfs_attr { |
||||
- struct list_head node; |
||||
- char path[PATH_SIZE]; |
||||
- char *value; /* points to value_local if value is cached */ |
||||
- char value_local[NAME_SIZE]; |
||||
-}; |
||||
int sysfs_init(void) |
||||
{ |
||||
const char *env; |
||||
@@ -85,22 +76,14 @@ int sysfs_init(void) |
||||
dbg("sysfs_path='%s'", sysfs_path); |
||||
|
||||
INIT_LIST_HEAD(&dev_list); |
||||
- INIT_LIST_HEAD(&attr_list); |
||||
return 0; |
||||
} |
||||
|
||||
void sysfs_cleanup(void) |
||||
{ |
||||
- struct sysfs_attr *attr_loop; |
||||
- struct sysfs_attr *attr_temp; |
||||
struct sysfs_device *dev_loop; |
||||
struct sysfs_device *dev_temp; |
||||
|
||||
- list_for_each_entry_safe(attr_loop, attr_temp, &attr_list, node) { |
||||
- list_del_init(&attr_loop->node); |
||||
- free(attr_loop); |
||||
- } |
||||
- |
||||
list_for_each_entry_safe(dev_loop, dev_temp, &dev_list, node) { |
||||
list_del_init(&dev_loop->node); |
||||
free(dev_loop); |
||||
@@ -355,10 +338,7 @@ struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device |
||||
char *sysfs_attr_get_value(const char *devpath, const char *attr_name) |
||||
{ |
||||
char path_full[PATH_SIZE]; |
||||
- const char *path; |
||||
- char value[NAME_SIZE]; |
||||
- struct sysfs_attr *attr_loop; |
||||
- struct sysfs_attr *attr; |
||||
+ char value[NAME_SIZE] = { '\0', }; |
||||
struct stat statbuf; |
||||
int fd; |
||||
ssize_t size; |
||||
@@ -368,29 +348,10 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) |
||||
sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full)); |
||||
if(sysfs_len >= sizeof(path_full)) |
||||
sysfs_len = sizeof(path_full) - 1; |
||||
- path = &path_full[sysfs_len]; |
||||
strlcat(path_full, devpath, sizeof(path_full)); |
||||
strlcat(path_full, "/", sizeof(path_full)); |
||||
strlcat(path_full, attr_name, sizeof(path_full)); |
||||
|
||||
- /* look for attribute in cache */ |
||||
- list_for_each_entry(attr_loop, &attr_list, node) { |
||||
- if (strcmp(attr_loop->path, path) == 0) { |
||||
- dbg("found in cache '%s'", attr_loop->path); |
||||
- return attr_loop->value; |
||||
- } |
||||
- } |
||||
- |
||||
- /* store attribute in cache (also negatives are kept in cache) */ |
||||
- dbg("new uncached attribute '%s'", path_full); |
||||
- attr = malloc(sizeof(struct sysfs_attr)); |
||||
- if (attr == NULL) |
||||
- return NULL; |
||||
- memset(attr, 0x00, sizeof(struct sysfs_attr)); |
||||
- strlcpy(attr->path, path, sizeof(attr->path)); |
||||
- dbg("add to cache '%s'", path_full); |
||||
- list_add(&attr->node, &attr_list); |
||||
- |
||||
if (lstat(path_full, &statbuf) != 0) { |
||||
dbg("stat '%s' failed: %s", path_full, strerror(errno)); |
||||
goto out; |
||||
@@ -408,8 +369,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) |
||||
pos = strrchr(link_target, '/'); |
||||
if (pos != NULL) { |
||||
dbg("cache '%s' with link value '%s'", path_full, value); |
||||
- strlcpy(attr->value_local, &pos[1], sizeof(attr->value_local)); |
||||
- attr->value = attr->value_local; |
||||
+ strlcpy(value, &pos[1], NAME_SIZE); |
||||
} |
||||
} |
||||
goto out; |
||||
@@ -439,12 +399,11 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) |
||||
/* got a valid value, store and return it */ |
||||
value[size] = '\0'; |
||||
remove_trailing_chars(value, '\n'); |
||||
- dbg("cache '%s' with attribute value '%s'", path_full, value); |
||||
- strlcpy(attr->value_local, value, sizeof(attr->value_local)); |
||||
- attr->value = attr->value_local; |
||||
|
||||
out: |
||||
- return attr->value; |
||||
+ if (value[0] == '\0') |
||||
+ return NULL; |
||||
+ return strdup(value); |
||||
} |
||||
|
||||
int sysfs_lookup_devpath_by_subsys_id(char *devpath_full, size_t len, const char *subsystem, const char *id) |
||||
@@ -567,8 +526,10 @@ char *sysfs_get_value(const char *id, char *subsys, char *param) |
||||
} |
||||
|
||||
if (!strncmp(sysfs_value, "<NULL>", 6) || |
||||
- !strncmp(sysfs_value, "(null)", 6)) |
||||
+ !strncmp(sysfs_value, "(null)", 6)) { |
||||
+ free(sysfs_value); |
||||
return NULL; |
||||
+ } |
||||
|
||||
return sysfs_value; |
||||
} |
||||
@@ -585,6 +546,7 @@ int sysfs_get_uint(char *id, char *subsys, char *param, |
||||
|
||||
errno = 0; |
||||
*value = strtoul(sysfs_value, NULL, 0); |
||||
+ free(sysfs_value); |
||||
if (errno) |
||||
return errno; |
||||
return 0; |
||||
@@ -600,6 +562,7 @@ int sysfs_get_int(const char *id, char *subsys, char *param, int *value) |
||||
return EIO; |
||||
|
||||
*value = atoi(sysfs_value); |
||||
+ free(sysfs_value); |
||||
return 0; |
||||
} |
||||
|
||||
@@ -619,6 +582,7 @@ int sysfs_get_str(char *id, char *subsys, char *param, char *value, |
||||
sysfs_value[len - 1] = '\0'; |
||||
strncpy(value, sysfs_value, value_size); |
||||
value[value_size - 1] = '\0'; |
||||
+ free(sysfs_value); |
||||
return 0; |
||||
} |
||||
|
||||
@@ -631,8 +595,11 @@ int sysfs_get_uint64(char *id, char *subsys, char *param, uint64_t *value) |
||||
if (!sysfs_value) |
||||
return EIO; |
||||
|
||||
- if (sscanf(sysfs_value, "%" PRIu64 "\n", value) != 1) |
||||
+ if (sscanf(sysfs_value, "%" PRIu64 "\n", value) != 1) { |
||||
+ free(sysfs_value); |
||||
return EINVAL; |
||||
+ } |
||||
+ free(sysfs_value); |
||||
return 0; |
||||
} |
||||
|
||||
@@ -647,6 +614,7 @@ int sysfs_get_uint8(char *id, char *subsys, char *param, |
||||
return EIO; |
||||
|
||||
*value = (uint8_t)atoi(sysfs_value); |
||||
+ free(sysfs_value); |
||||
return 0; |
||||
} |
||||
|
||||
@@ -661,6 +629,7 @@ int sysfs_get_uint16(char *id, char *subsys, char *param, |
||||
return EIO; |
||||
|
||||
*value = (uint16_t)atoi(sysfs_value); |
||||
+ free(sysfs_value); |
||||
return 0; |
||||
} |
||||
|
||||
-- |
||||
2.5.5 |
||||
|
@ -0,0 +1,585 @@
@@ -0,0 +1,585 @@
|
||||
From 4d3d30ea5bcb917fed58f1cb57154de5e6ce2349 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Fri, 24 Jul 2015 14:18:30 -0700 |
||||
Subject: [PATCH] share session use checks with iscsiadm, apply for flashnode |
||||
session |
||||
|
||||
--- |
||||
usr/Makefile | 8 +- |
||||
usr/initiator.c | 196 +---------------------------------------- |
||||
usr/initiator.h | 1 + |
||||
usr/initiator_common.c | 3 + |
||||
usr/iscsiadm.c | 23 +++++ |
||||
usr/iscsistart.c | 2 + |
||||
usr/mntcheck.c | 234 +++++++++++++++++++++++++++++++++++++++++++++++++ |
||||
7 files changed, 268 insertions(+), 199 deletions(-) |
||||
create mode 100644 usr/mntcheck.c |
||||
|
||||
diff --git a/usr/Makefile b/usr/Makefile |
||||
index b2c1504..93b03d5 100644 |
||||
--- a/usr/Makefile |
||||
+++ b/usr/Makefile |
||||
@@ -54,15 +54,15 @@ DISCOVERY_SRCS = $(FW_BOOT_SRCS) strings.o discovery.o |
||||
all: $(PROGRAMS) |
||||
|
||||
iscsid: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(DISCOVERY_SRCS) \ |
||||
- iscsid.o session_mgmt.o discoveryd.o |
||||
+ iscsid.o session_mgmt.o discoveryd.o mntcheck.o |
||||
$(CC) $(CFLAGS) $^ -o $@ -L../utils/open-isns -lisns -lmount |
||||
|
||||
-iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_SRCS) iscsiadm.o session_mgmt.o |
||||
- $(CC) $(CFLAGS) $^ -o $@ -L../utils/open-isns -lisns |
||||
+iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_SRCS) iscsiadm.o session_mgmt.o mntcheck.o |
||||
+ $(CC) $(CFLAGS) $^ -o $@ -L../utils/open-isns -lisns -lmount |
||||
|
||||
iscsistart: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \ |
||||
iscsistart.o statics.o |
||||
- $(CC) $(CFLAGS) -static $^ -o $@ -lmount |
||||
+ $(CC) $(CFLAGS) -static $^ -o $@ |
||||
clean: |
||||
rm -f *.o $(PROGRAMS) .depend $(LIBSYS) |
||||
|
||||
diff --git a/usr/initiator.c b/usr/initiator.c |
||||
index 1b4c90a..701b9a5 100644 |
||||
--- a/usr/initiator.c |
||||
+++ b/usr/initiator.c |
||||
@@ -30,7 +30,6 @@ |
||||
#include <errno.h> |
||||
#include <dirent.h> |
||||
#include <fcntl.h> |
||||
-#include <libmount/libmount.h> |
||||
|
||||
#include "initiator.h" |
||||
#include "transport.h" |
||||
@@ -2141,199 +2140,6 @@ static int session_unbind(struct iscsi_session *session) |
||||
return err; |
||||
} |
||||
|
||||
-static struct libmnt_table *mtab, *swaps; |
||||
-static struct libmnt_cache *mntcache; |
||||
- |
||||
-static void libmount_cleanup(void) |
||||
-{ |
||||
- mnt_free_table(mtab); |
||||
- mnt_free_table(swaps); |
||||
- mnt_free_cache(mntcache); |
||||
- mtab = swaps = mntcache = NULL; |
||||
-} |
||||
- |
||||
-static int libmount_init(void) |
||||
-{ |
||||
- mnt_init_debug(0); |
||||
- mtab = mnt_new_table(); |
||||
- swaps = mnt_new_table(); |
||||
- mntcache = mnt_new_cache(); |
||||
- if (!mtab || !swaps || !mntcache) { |
||||
- libmount_cleanup(); |
||||
- return -ENOMEM; |
||||
- } |
||||
- mnt_table_set_cache(mtab, mntcache); |
||||
- mnt_table_set_cache(swaps, mntcache); |
||||
- mnt_table_parse_mtab(mtab, NULL); |
||||
- mnt_table_parse_swaps(swaps, NULL); |
||||
- return 0; |
||||
-} |
||||
- |
||||
-static int trans_filter(const struct dirent *d) |
||||
-{ |
||||
- if (!strcmp(".", d->d_name) || !strcmp("..", d->d_name)) |
||||
- return 0; |
||||
- return 1; |
||||
-} |
||||
- |
||||
-static int subdir_filter(const struct dirent *d) |
||||
-{ |
||||
- if (!(d->d_type & DT_DIR)) |
||||
- return 0; |
||||
- return trans_filter(d); |
||||
-} |
||||
- |
||||
-static int is_partition(const char *path) |
||||
-{ |
||||
- char *devtype; |
||||
- int rc = 0; |
||||
- |
||||
- devtype = sysfs_get_uevent_devtype(path); |
||||
- if (!devtype) |
||||
- return 0; |
||||
- if (strcmp(devtype, "partition") == 0) |
||||
- rc = 1; |
||||
- free(devtype); |
||||
- return rc; |
||||
-} |
||||
- |
||||
-static int blockdev_check_mnts(char *syspath) |
||||
-{ |
||||
- struct libmnt_fs *fs; |
||||
- char *devname = NULL; |
||||
- char *_devname = NULL; |
||||
- int rc = 0; |
||||
- |
||||
- devname = sysfs_get_uevent_devname(syspath); |
||||
- if (!devname) |
||||
- goto out; |
||||
- |
||||
- _devname = calloc(1, PATH_MAX); |
||||
- if (!_devname) |
||||
- goto out; |
||||
- snprintf(_devname, PATH_MAX, "/dev/%s", devname); |
||||
- |
||||
- fs = mnt_table_find_source(mtab, _devname, MNT_ITER_FORWARD); |
||||
- if (fs) { |
||||
- rc = 1; |
||||
- goto out; |
||||
- } |
||||
- fs = mnt_table_find_source(swaps, _devname, MNT_ITER_FORWARD); |
||||
- if (fs) |
||||
- rc = 1; |
||||
-out: |
||||
- free(devname); |
||||
- free(_devname); |
||||
- return rc; |
||||
-} |
||||
- |
||||
-static int count_device_users(char *syspath); |
||||
- |
||||
-static int blockdev_get_partitions(char *syspath) |
||||
-{ |
||||
- struct dirent **parts = NULL; |
||||
- int n, i; |
||||
- int count = 0; |
||||
- |
||||
- n = scandir(syspath, &parts, subdir_filter, alphasort); |
||||
- for (i = 0; i < n; i++) { |
||||
- char *newpath; |
||||
- |
||||
- newpath = calloc(1, PATH_MAX); |
||||
- if (!newpath) |
||||
- continue; |
||||
- snprintf(newpath, PATH_MAX, "%s/%s", syspath, parts[i]->d_name); |
||||
- free(parts[i]); |
||||
- if (is_partition(newpath)) { |
||||
- count += count_device_users(newpath); |
||||
- } |
||||
- free(newpath); |
||||
- } |
||||
- free(parts); |
||||
- return count; |
||||
-} |
||||
- |
||||
-static int blockdev_get_holders(char *syspath) |
||||
-{ |
||||
- char *path = NULL; |
||||
- struct dirent **holds = NULL; |
||||
- int n, i; |
||||
- int count = 0; |
||||
- |
||||
- path = calloc(1, PATH_MAX); |
||||
- if (!path) |
||||
- return 0; |
||||
- snprintf(path, PATH_MAX, "%s/holders", syspath); |
||||
- |
||||
- n = scandir(path, &holds, trans_filter, alphasort); |
||||
- for (i = 0; i < n; i++) { |
||||
- char *newpath; |
||||
- char *rp; |
||||
- |
||||
- newpath = calloc(1, PATH_MAX); |
||||
- if (!newpath) |
||||
- continue; |
||||
- snprintf(newpath, PATH_MAX, "%s/%s", path, holds[i]->d_name); |
||||
- |
||||
- free(holds[i]); |
||||
- rp = realpath(newpath, NULL); |
||||
- if (rp) |
||||
- count += count_device_users(rp); |
||||
- free(newpath); |
||||
- free(rp); |
||||
- } |
||||
- free(path); |
||||
- free(holds); |
||||
- return count; |
||||
-} |
||||
- |
||||
-static int count_device_users(char *syspath) |
||||
-{ |
||||
- int count = 0; |
||||
- count += blockdev_check_mnts(syspath); |
||||
- count += blockdev_get_partitions(syspath); |
||||
- count += blockdev_get_holders(syspath); |
||||
- return count; |
||||
-}; |
||||
- |
||||
-static void device_in_use(void *data, int host_no, int target, int lun) |
||||
-{ |
||||
- char *syspath = NULL; |
||||
- char *devname = NULL; |
||||
- int *count = data; |
||||
- |
||||
- devname = iscsi_sysfs_get_blockdev_from_lun(host_no, target, lun); |
||||
- if (!devname) |
||||
- goto out; |
||||
- syspath = calloc(1, PATH_MAX); |
||||
- if (!syspath) |
||||
- goto out; |
||||
- snprintf(syspath, PATH_MAX, "/sys/class/block/%s", devname); |
||||
- *count += count_device_users(syspath); |
||||
-out: |
||||
- free(syspath); |
||||
- free(devname); |
||||
-} |
||||
- |
||||
-static int session_in_use(int sid) |
||||
-{ |
||||
- int host_no = -1, err = 0; |
||||
- int count = 0; |
||||
- |
||||
- if (libmount_init()) { |
||||
- log_error("Failed to initialize libmount, " |
||||
- "not checking for active mounts on session [%d].\n", sid); |
||||
- return 0; |
||||
- } |
||||
- |
||||
- host_no = iscsi_sysfs_get_host_no_from_sid(sid, &err); |
||||
- if (!err) |
||||
- iscsi_sysfs_for_each_device(&count, host_no, sid, device_in_use); |
||||
- |
||||
- libmount_cleanup(); |
||||
- return count; |
||||
-} |
||||
- |
||||
int session_logout_task(int sid, queue_task_t *qtask) |
||||
{ |
||||
iscsi_session_t *session; |
||||
@@ -2363,7 +2169,7 @@ invalid_state: |
||||
|
||||
if (dconfig->safe_logout && session_in_use(sid)) { |
||||
log_error("Session is actively in use for mounted storage, " |
||||
- "and iscsid.safe_logout is configured.\n"); |
||||
+ "and iscsid.safe_logout is configured."); |
||||
return ISCSI_ERR_BUSY; |
||||
} |
||||
|
||||
diff --git a/usr/initiator.h b/usr/initiator.h |
||||
index c34625b..e8bce45 100644 |
||||
--- a/usr/initiator.h |
||||
+++ b/usr/initiator.h |
||||
@@ -360,4 +360,5 @@ extern int iscsi_set_net_config(struct iscsi_transport *t, |
||||
struct iface_rec *iface); |
||||
extern void iscsi_session_init_params(struct iscsi_session *session); |
||||
|
||||
+extern int session_in_use(int sid); |
||||
#endif /* INITIATOR_H */ |
||||
diff --git a/usr/initiator_common.c b/usr/initiator_common.c |
||||
index 8ff993d..4e574b4 100644 |
||||
--- a/usr/initiator_common.c |
||||
+++ b/usr/initiator_common.c |
||||
@@ -23,6 +23,8 @@ |
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include <errno.h> |
||||
+#include <dirent.h> |
||||
+#include <libmount/libmount.h> |
||||
|
||||
#include "initiator.h" |
||||
#include "transport.h" |
||||
@@ -741,3 +743,4 @@ int iscsi_host_set_net_params(struct iface_rec *iface, |
||||
} |
||||
return 0; |
||||
} |
||||
+ |
||||
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c |
||||
index f886d39..d5d38b1 100644 |
||||
--- a/usr/iscsiadm.c |
||||
+++ b/usr/iscsiadm.c |
||||
@@ -1898,11 +1898,34 @@ exit_logout: |
||||
return rc; |
||||
} |
||||
|
||||
+static int iscsi_check_session_use_count(uint32_t sid) { |
||||
+ char *config_file; |
||||
+ char *safe_logout; |
||||
+ |
||||
+ config_file = get_config_file(); |
||||
+ if (!config_file) { |
||||
+ log_error("Could not get config file from iscsid"); |
||||
+ return 0; |
||||
+ } |
||||
+ |
||||
+ safe_logout = cfg_get_string_param(config_file, "iscsid.safe_logout"); |
||||
+ if (!safe_logout || strcmp(safe_logout, "Yes")) |
||||
+ return 0; |
||||
+ |
||||
+ return session_in_use(sid); |
||||
+} |
||||
+ |
||||
int iscsi_logout_flashnode_sid(struct iscsi_transport *t, uint32_t host_no, |
||||
uint32_t sid) |
||||
{ |
||||
int fd, rc = 0; |
||||
|
||||
+ if (iscsi_check_session_use_count(sid)) { |
||||
+ log_error("Session is actively in use for mounted storage, " |
||||
+ "and iscsid.safe_logout is configured."); |
||||
+ return ISCSI_ERR_BUSY; |
||||
+ } |
||||
+ |
||||
fd = ipc->ctldev_open(); |
||||
if (fd < 0) { |
||||
log_error("Netlink open failed."); |
||||
diff --git a/usr/iscsistart.c b/usr/iscsistart.c |
||||
index 6924d49..26ba014 100644 |
||||
--- a/usr/iscsistart.c |
||||
+++ b/usr/iscsistart.c |
||||
@@ -279,6 +279,8 @@ static int setup_session(void) |
||||
return rc; |
||||
} |
||||
|
||||
+int session_in_use(int sid) { return 0; } |
||||
+ |
||||
static void catch_signal(int signo) |
||||
{ |
||||
log_warning("pid %d caught signal -%d", getpid(), signo); |
||||
diff --git a/usr/mntcheck.c b/usr/mntcheck.c |
||||
new file mode 100644 |
||||
index 0000000..57bf007 |
||||
--- /dev/null |
||||
+++ b/usr/mntcheck.c |
||||
@@ -0,0 +1,234 @@ |
||||
+/* |
||||
+ * Common code for checking sessions for mnt use |
||||
+ * |
||||
+ * Copyright (C) 2014 - 2015 Chris Leech |
||||
+ * Copyright (C) 2014 - 2015 Red Hat, Inc. All rights reserved. |
||||
+ * |
||||
+ * This program is free software; you can redistribute it and/or modify |
||||
+ * it under the terms of the GNU General Public License as published |
||||
+ * by the Free Software Foundation; either version 2 of the License, or |
||||
+ * (at your option) any later version. |
||||
+ * |
||||
+ * This program is distributed in the hope that it will be useful, but |
||||
+ * WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||
+ * General Public License for more details. |
||||
+ * |
||||
+ * See the file COPYING included with this distribution for more details. |
||||
+ */ |
||||
+ |
||||
+#include <string.h> |
||||
+#include <stdio.h> |
||||
+#include <stdlib.h> |
||||
+#include <errno.h> |
||||
+#include <dirent.h> |
||||
+#include <libmount/libmount.h> |
||||
+ |
||||
+#include "initiator.h" |
||||
+#include "transport.h" |
||||
+#include "iscsid.h" |
||||
+#include "iscsi_ipc.h" |
||||
+#include "log.h" |
||||
+#include "iscsi_sysfs.h" |
||||
+#include "iscsi_settings.h" |
||||
+#include "iface.h" |
||||
+#include "host.h" |
||||
+#include "sysdeps.h" |
||||
+#include "iscsi_err.h" |
||||
+#include "iscsi_net_util.h" |
||||
+ |
||||
+static struct libmnt_table *mtab, *swaps; |
||||
+static struct libmnt_cache *mntcache; |
||||
+ |
||||
+static void libmount_cleanup(void) |
||||
+{ |
||||
+ mnt_free_table(mtab); |
||||
+ mnt_free_table(swaps); |
||||
+ mnt_free_cache(mntcache); |
||||
+ mtab = NULL; |
||||
+ swaps = NULL; |
||||
+ mntcache = NULL; |
||||
+} |
||||
+ |
||||
+static int libmount_init(void) |
||||
+{ |
||||
+ mnt_init_debug(0); |
||||
+ mtab = mnt_new_table(); |
||||
+ swaps = mnt_new_table(); |
||||
+ mntcache = mnt_new_cache(); |
||||
+ if (!mtab || !swaps || !mntcache) { |
||||
+ libmount_cleanup(); |
||||
+ return -ENOMEM; |
||||
+ } |
||||
+ mnt_table_set_cache(mtab, mntcache); |
||||
+ mnt_table_set_cache(swaps, mntcache); |
||||
+ mnt_table_parse_mtab(mtab, NULL); |
||||
+ mnt_table_parse_swaps(swaps, NULL); |
||||
+ return 0; |
||||
+} |
||||
+ |
||||
+static int trans_filter(const struct dirent *d) |
||||
+{ |
||||
+ if (!strcmp(".", d->d_name) || !strcmp("..", d->d_name)) |
||||
+ return 0; |
||||
+ return 1; |
||||
+} |
||||
+ |
||||
+static int subdir_filter(const struct dirent *d) |
||||
+{ |
||||
+ if (!(d->d_type & DT_DIR)) |
||||
+ return 0; |
||||
+ return trans_filter(d); |
||||
+} |
||||
+ |
||||
+static int is_partition(const char *path) |
||||
+{ |
||||
+ char *devtype; |
||||
+ int rc = 0; |
||||
+ |
||||
+ devtype = sysfs_get_uevent_devtype(path); |
||||
+ if (!devtype) |
||||
+ return 0; |
||||
+ if (strcmp(devtype, "partition") == 0) |
||||
+ rc = 1; |
||||
+ free(devtype); |
||||
+ return rc; |
||||
+} |
||||
+ |
||||
+static int blockdev_check_mnts(char *syspath) |
||||
+{ |
||||
+ struct libmnt_fs *fs; |
||||
+ char *devname = NULL; |
||||
+ char *_devname = NULL; |
||||
+ int rc = 0; |
||||
+ |
||||
+ devname = sysfs_get_uevent_devname(syspath); |
||||
+ if (!devname) |
||||
+ goto out; |
||||
+ |
||||
+ _devname = calloc(1, PATH_MAX); |
||||
+ if (!_devname) |
||||
+ goto out; |
||||
+ snprintf(_devname, PATH_MAX, "/dev/%s", devname); |
||||
+ |
||||
+ fs = mnt_table_find_source(mtab, _devname, MNT_ITER_FORWARD); |
||||
+ if (fs) { |
||||
+ rc = 1; |
||||
+ goto out; |
||||
+ } |
||||
+ fs = mnt_table_find_source(swaps, _devname, MNT_ITER_FORWARD); |
||||
+ if (fs) |
||||
+ rc = 1; |
||||
+out: |
||||
+ free(devname); |
||||
+ free(_devname); |
||||
+ return rc; |
||||
+} |
||||
+ |
||||
+static int count_device_users(char *syspath); |
||||
+ |
||||
+static int blockdev_get_partitions(char *syspath) |
||||
+{ |
||||
+ struct dirent **parts = NULL; |
||||
+ int n, i; |
||||
+ int count = 0; |
||||
+ |
||||
+ n = scandir(syspath, &parts, subdir_filter, alphasort); |
||||
+ for (i = 0; i < n; i++) { |
||||
+ char *newpath; |
||||
+ |
||||
+ newpath = calloc(1, PATH_MAX); |
||||
+ if (!newpath) |
||||
+ continue; |
||||
+ snprintf(newpath, PATH_MAX, "%s/%s", syspath, parts[i]->d_name); |
||||
+ free(parts[i]); |
||||
+ if (is_partition(newpath)) { |
||||
+ count += count_device_users(newpath); |
||||
+ } |
||||
+ free(newpath); |
||||
+ } |
||||
+ free(parts); |
||||
+ return count; |
||||
+} |
||||
+ |
||||
+static int blockdev_get_holders(char *syspath) |
||||
+{ |
||||
+ char *path = NULL; |
||||
+ struct dirent **holds = NULL; |
||||
+ int n, i; |
||||
+ int count = 0; |
||||
+ |
||||
+ path = calloc(1, PATH_MAX); |
||||
+ if (!path) |
||||
+ return 0; |
||||
+ snprintf(path, PATH_MAX, "%s/holders", syspath); |
||||
+ |
||||
+ n = scandir(path, &holds, trans_filter, alphasort); |
||||
+ for (i = 0; i < n; i++) { |
||||
+ char *newpath; |
||||
+ char *rp; |
||||
+ |
||||
+ newpath = calloc(1, PATH_MAX); |
||||
+ if (!newpath) |
||||
+ continue; |
||||
+ snprintf(newpath, PATH_MAX, "%s/%s", path, holds[i]->d_name); |
||||
+ |
||||
+ free(holds[i]); |
||||
+ rp = realpath(newpath, NULL); |
||||
+ if (rp) |
||||
+ count += count_device_users(rp); |
||||
+ free(newpath); |
||||
+ free(rp); |
||||
+ } |
||||
+ free(path); |
||||
+ free(holds); |
||||
+ return count; |
||||
+} |
||||
+ |
||||
+static int count_device_users(char *syspath) |
||||
+{ |
||||
+ int count = 0; |
||||
+ count += blockdev_check_mnts(syspath); |
||||
+ count += blockdev_get_partitions(syspath); |
||||
+ count += blockdev_get_holders(syspath); |
||||
+ return count; |
||||
+}; |
||||
+ |
||||
+static void device_in_use(void *data, int host_no, int target, int lun) |
||||
+{ |
||||
+ char *syspath = NULL; |
||||
+ char *devname = NULL; |
||||
+ int *count = data; |
||||
+ |
||||
+ devname = iscsi_sysfs_get_blockdev_from_lun(host_no, target, lun); |
||||
+ if (!devname) |
||||
+ goto out; |
||||
+ syspath = calloc(1, PATH_MAX); |
||||
+ if (!syspath) |
||||
+ goto out; |
||||
+ snprintf(syspath, PATH_MAX, "/sys/class/block/%s", devname); |
||||
+ *count += count_device_users(syspath); |
||||
+out: |
||||
+ free(syspath); |
||||
+ free(devname); |
||||
+} |
||||
+ |
||||
+int session_in_use(int sid) |
||||
+{ |
||||
+ int host_no = -1, err = 0; |
||||
+ int count = 0; |
||||
+ |
||||
+ if (libmount_init()) { |
||||
+ log_error("Failed to initialize libmount, " |
||||
+ "not checking for active mounts on session [%d].\n", sid); |
||||
+ return 0; |
||||
+ } |
||||
+ |
||||
+ host_no = iscsi_sysfs_get_host_no_from_sid(sid, &err); |
||||
+ if (!err) |
||||
+ iscsi_sysfs_for_each_device(&count, host_no, sid, device_in_use); |
||||
+ |
||||
+ libmount_cleanup(); |
||||
+ return count; |
||||
+} |
||||
+ |
||||
-- |
||||
2.1.0 |
||||
|
@ -0,0 +1,354 @@
@@ -0,0 +1,354 @@
|
||||
From 46ba8eed79fa13b32947b5c5b1bf0bc133b14c41 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Tue, 3 Feb 2015 16:28:15 -0800 |
||||
Subject: [PATCH] iscsid safe session logout |
||||
|
||||
Implement a safe logout option, which uses libmount from util-linux to |
||||
check for active mounts (and swaps) over devices, their partitions, and |
||||
any holders (like LVM and multipath device maps). When enabled iscsid |
||||
will refuse to logout of sessions actively being used for mounts, |
||||
returning a status of EBUSY to the ipc request. |
||||
|
||||
I've made it a configuration option (iscsid.safe_logout) that defaults |
||||
to "No" to preserve the existing behavior as the default, while making |
||||
it available for users that prefer a safety check. |
||||
|
||||
This does add a new dependency on libmount. |
||||
|
||||
Signed-off-by: Chris Leech <cleech@redhat.com> |
||||
--- |
||||
etc/iscsid.conf | 3 + |
||||
usr/Makefile | 4 +- |
||||
usr/initiator.c | 199 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||||
usr/sysfs.c | 40 ++++++++++++ |
||||
usr/sysfs.h | 4 ++ |
||||
5 files changed, 248 insertions(+), 2 deletions(-) |
||||
|
||||
diff --git a/etc/iscsid.conf b/etc/iscsid.conf |
||||
index ef76dc0..6d9a5c0 100644 |
||||
--- a/etc/iscsid.conf |
||||
+++ b/etc/iscsid.conf |
||||
@@ -22,6 +22,9 @@ |
||||
# Default for upstream open-iscsi scripts (uncomment to activate). |
||||
iscsid.startup = /sbin/iscsid |
||||
|
||||
+# Check for active mounts on devices reachable through a session |
||||
+# and refuse to logout if there are any. Defaults to "No". |
||||
+# iscsid.safe_logout = Yes |
||||
|
||||
############################# |
||||
# NIC/HBA and driver settings |
||||
diff --git a/usr/Makefile b/usr/Makefile |
||||
index 3d8ee22..b2c1504 100644 |
||||
--- a/usr/Makefile |
||||
+++ b/usr/Makefile |
||||
@@ -55,14 +55,14 @@ all: $(PROGRAMS) |
||||
|
||||
iscsid: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(DISCOVERY_SRCS) \ |
||||
iscsid.o session_mgmt.o discoveryd.o |
||||
- $(CC) $(CFLAGS) $^ -o $@ -L../utils/open-isns -lisns |
||||
+ $(CC) $(CFLAGS) $^ -o $@ -L../utils/open-isns -lisns -lmount |
||||
|
||||
iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_SRCS) iscsiadm.o session_mgmt.o |
||||
$(CC) $(CFLAGS) $^ -o $@ -L../utils/open-isns -lisns |
||||
|
||||
iscsistart: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \ |
||||
iscsistart.o statics.o |
||||
- $(CC) $(CFLAGS) -static $^ -o $@ |
||||
+ $(CC) $(CFLAGS) -static $^ -o $@ -lmount |
||||
clean: |
||||
rm -f *.o $(PROGRAMS) .depend $(LIBSYS) |
||||
|
||||
diff --git a/usr/initiator.c b/usr/initiator.c |
||||
index 9d02f47..ac1a3ac 100644 |
||||
--- a/usr/initiator.c |
||||
+++ b/usr/initiator.c |
||||
@@ -30,6 +30,7 @@ |
||||
#include <errno.h> |
||||
#include <dirent.h> |
||||
#include <fcntl.h> |
||||
+#include <libmount/libmount.h> |
||||
|
||||
#include "initiator.h" |
||||
#include "transport.h" |
||||
@@ -2140,11 +2141,200 @@ static int session_unbind(struct iscsi_session *session) |
||||
return err; |
||||
} |
||||
|
||||
+static struct libmnt_table *mtab, *swaps; |
||||
+ |
||||
+static void libmount_cleanup(void) |
||||
+{ |
||||
+ mnt_free_table(mtab); |
||||
+ mnt_free_table(swaps); |
||||
+ mtab = swaps = NULL; |
||||
+} |
||||
+ |
||||
+static int libmount_init(void) |
||||
+{ |
||||
+ mnt_init_debug(0); |
||||
+ mtab = mnt_new_table(); |
||||
+ swaps = mnt_new_table(); |
||||
+ if (!mtab || !swaps) { |
||||
+ libmount_cleanup(); |
||||
+ return -ENOMEM; |
||||
+ } |
||||
+ mnt_table_parse_mtab(mtab, NULL); |
||||
+ mnt_table_parse_swaps(swaps, NULL); |
||||
+ return 0; |
||||
+} |
||||
+ |
||||
+static int trans_filter(const struct dirent *d) |
||||
+{ |
||||
+ if (!strcmp(".", d->d_name) || !strcmp("..", d->d_name)) |
||||
+ return 0; |
||||
+ return 1; |
||||
+} |
||||
+ |
||||
+static int subdir_filter(const struct dirent *d) |
||||
+{ |
||||
+ if (!(d->d_type & DT_DIR)) |
||||
+ return 0; |
||||
+ return trans_filter(d); |
||||
+} |
||||
+ |
||||
+static int is_partition(const char *path) |
||||
+{ |
||||
+ char *devtype; |
||||
+ int rc = 0; |
||||
+ |
||||
+ devtype = sysfs_get_uevent_devtype(path); |
||||
+ if (!devtype) |
||||
+ return 0; |
||||
+ if (strcmp(devtype, "partition") == 0) |
||||
+ rc = 1; |
||||
+ free(devtype); |
||||
+ return rc; |
||||
+} |
||||
+ |
||||
+static int blockdev_check_mnts(char *syspath) |
||||
+{ |
||||
+ struct libmnt_fs *fs; |
||||
+ char *devname = NULL; |
||||
+ char *_devname = NULL; |
||||
+ int rc = 0; |
||||
+ |
||||
+ devname = sysfs_get_uevent_devname(syspath); |
||||
+ if (!devname) |
||||
+ goto out; |
||||
+ |
||||
+ _devname = calloc(1, PATH_MAX); |
||||
+ if (!_devname) |
||||
+ goto out; |
||||
+ snprintf(_devname, PATH_MAX, "/dev/%s", devname); |
||||
+ |
||||
+ fs = mnt_table_find_source(mtab, _devname, MNT_ITER_FORWARD); |
||||
+ if (fs) { |
||||
+ rc = 1; |
||||
+ goto out; |
||||
+ } |
||||
+ fs = mnt_table_find_source(swaps, _devname, MNT_ITER_FORWARD); |
||||
+ if (fs) |
||||
+ rc = 1; |
||||
+out: |
||||
+ free(devname); |
||||
+ free(_devname); |
||||
+ return rc; |
||||
+} |
||||
+ |
||||
+static int count_device_users(char *syspath); |
||||
+ |
||||
+static int blockdev_get_partitions(char *syspath) |
||||
+{ |
||||
+ struct dirent **parts = NULL; |
||||
+ int n, i; |
||||
+ int count = 0; |
||||
+ |
||||
+ n = scandir(syspath, &parts, subdir_filter, alphasort); |
||||
+ for (i = 0; i < n; i++) { |
||||
+ char *newpath; |
||||
+ |
||||
+ newpath = calloc(1, PATH_MAX); |
||||
+ if (!newpath) |
||||
+ continue; |
||||
+ snprintf(newpath, PATH_MAX, "%s/%s", syspath, parts[i]->d_name); |
||||
+ free(parts[i]); |
||||
+ if (is_partition(newpath)) { |
||||
+ count += count_device_users(newpath); |
||||
+ } |
||||
+ free(newpath); |
||||
+ } |
||||
+ free(parts); |
||||
+ return count; |
||||
+} |
||||
+ |
||||
+static int blockdev_get_holders(char *syspath) |
||||
+{ |
||||
+ char *path = NULL; |
||||
+ struct dirent **holds = NULL; |
||||
+ int n, i; |
||||
+ int count = 0; |
||||
+ |
||||
+ path = calloc(1, PATH_MAX); |
||||
+ if (!path) |
||||
+ return 0; |
||||
+ snprintf(path, PATH_MAX, "%s/holders", syspath); |
||||
+ |
||||
+ n = scandir(path, &holds, trans_filter, alphasort); |
||||
+ for (i = 0; i < n; i++) { |
||||
+ char *newpath; |
||||
+ char *rp; |
||||
+ |
||||
+ newpath = calloc(1, PATH_MAX); |
||||
+ if (!newpath) |
||||
+ continue; |
||||
+ snprintf(newpath, PATH_MAX, "%s/%s", path, holds[i]->d_name); |
||||
+ |
||||
+ free(holds[i]); |
||||
+ rp = realpath(newpath, NULL); |
||||
+ if (rp) |
||||
+ count += count_device_users(rp); |
||||
+ free(newpath); |
||||
+ free(rp); |
||||
+ } |
||||
+ free(path); |
||||
+ free(holds); |
||||
+ return count; |
||||
+} |
||||
+ |
||||
+static int count_device_users(char *syspath) |
||||
+{ |
||||
+ int count = 0; |
||||
+ count += blockdev_check_mnts(syspath); |
||||
+ count += blockdev_get_partitions(syspath); |
||||
+ count += blockdev_get_holders(syspath); |
||||
+ return count; |
||||
+}; |
||||
+ |
||||
+static void device_in_use(void *data, int host_no, int target, int lun) |
||||
+{ |
||||
+ char *syspath = NULL; |
||||
+ char *devname = NULL; |
||||
+ int *count = data; |
||||
+ |
||||
+ devname = iscsi_sysfs_get_blockdev_from_lun(host_no, target, lun); |
||||
+ if (!devname) |
||||
+ goto out; |
||||
+ syspath = calloc(1, PATH_MAX); |
||||
+ if (!syspath) |
||||
+ goto out; |
||||
+ snprintf(syspath, PATH_MAX, "/sys/class/block/%s", devname); |
||||
+ *count += count_device_users(syspath); |
||||
+out: |
||||
+ free(syspath); |
||||
+ free(devname); |
||||
+} |
||||
+ |
||||
+static int session_in_use(int sid) |
||||
+{ |
||||
+ int host_no = -1, err = 0; |
||||
+ int count = 0; |
||||
+ |
||||
+ if (libmount_init()) { |
||||
+ log_error("Failed to initialize libmount, " |
||||
+ "not checking for active mounts on session [%d].\n", sid); |
||||
+ return 0; |
||||
+ } |
||||
+ |
||||
+ host_no = iscsi_sysfs_get_host_no_from_sid(sid, &err); |
||||
+ if (!err) |
||||
+ iscsi_sysfs_for_each_device(&count, host_no, sid, device_in_use); |
||||
+ |
||||
+ libmount_cleanup(); |
||||
+ return count; |
||||
+} |
||||
+ |
||||
int session_logout_task(int sid, queue_task_t *qtask) |
||||
{ |
||||
iscsi_session_t *session; |
||||
iscsi_conn_t *conn; |
||||
int rc = ISCSI_SUCCESS; |
||||
+ char *safe; |
||||
|
||||
session = session_find_by_sid(sid); |
||||
if (!session) { |
||||
@@ -2167,6 +2357,15 @@ invalid_state: |
||||
return ISCSI_ERR_INTERNAL; |
||||
} |
||||
|
||||
+ safe = cfg_get_string_param(dconfig->config_file, "iscsid.safe_logout"); |
||||
+ if (safe && !strcmp(safe, "Yes") && session_in_use(sid)) { |
||||
+ log_error("Session is actively in use for mounted storage, " |
||||
+ "and iscsid.safe_logout is configured.\n"); |
||||
+ free(safe); |
||||
+ return ISCSI_ERR_BUSY; |
||||
+ } |
||||
+ free(safe); |
||||
+ |
||||
/* FIXME: logout all active connections */ |
||||
conn = &session->conn[0]; |
||||
if (conn->logout_qtask) |
||||
diff --git a/usr/sysfs.c b/usr/sysfs.c |
||||
index d00c925..bbb00c0 100644 |
||||
--- a/usr/sysfs.c |
||||
+++ b/usr/sysfs.c |
||||
@@ -709,3 +709,43 @@ int sysfs_set_param(char *id, char *subsys, char *attr_name, |
||||
close(fd); |
||||
return rc; |
||||
} |
||||
+ |
||||
+char *sysfs_get_uevent_field(const char *path, const char *field) |
||||
+{ |
||||
+ char *uevent_path = NULL; |
||||
+ FILE *f = NULL; |
||||
+ char *line, buffer[1024]; |
||||
+ char *ff, *d; |
||||
+ char *out = NULL; |
||||
+ |
||||
+ uevent_path = calloc(1, PATH_MAX); |
||||
+ if (!uevent_path) |
||||
+ return NULL; |
||||
+ snprintf(uevent_path, PATH_MAX, "%s/uevent", path); |
||||
+ |
||||
+ f = fopen(uevent_path, "r"); |
||||
+ if (!f) |
||||
+ goto out; |
||||
+ while ((line = fgets(buffer, sizeof (buffer), f))) { |
||||
+ ff = strtok(line, "="); |
||||
+ d = strtok(NULL, "\n"); |
||||
+ if (strcmp(ff, field)) |
||||
+ continue; |
||||
+ out = strdup(d); |
||||
+ break; |
||||
+ } |
||||
+ fclose(f); |
||||
+out: |
||||
+ free(uevent_path); |
||||
+ return out; |
||||
+} |
||||
+ |
||||
+char *sysfs_get_uevent_devtype(const char *path) |
||||
+{ |
||||
+ return sysfs_get_uevent_field(path, "DEVTYPE"); |
||||
+} |
||||
+ |
||||
+char *sysfs_get_uevent_devname(const char *path) |
||||
+{ |
||||
+ return sysfs_get_uevent_field(path, "DEVNAME"); |
||||
+} |
||||
diff --git a/usr/sysfs.h b/usr/sysfs.h |
||||
index 304dbbf..462060e 100644 |
||||
--- a/usr/sysfs.h |
||||
+++ b/usr/sysfs.h |
||||
@@ -66,4 +66,8 @@ extern int sysfs_get_uint16(char *id, char *subsys, char *param, |
||||
extern int sysfs_set_param(char *id, char *subsys, char *attr_name, |
||||
char *write_buf, ssize_t buf_size); |
||||
|
||||
+extern char *sysfs_get_uevent_field(const char *path, const char *field); |
||||
+extern char *sysfs_get_uevent_devtype(const char *path); |
||||
+extern char *sysfs_get_uevent_devname(const char *path); |
||||
+ |
||||
#endif |
||||
-- |
||||
2.1.0 |
||||
|
@ -0,0 +1,82 @@
@@ -0,0 +1,82 @@
|
||||
From 006270c0f9a1fa1e78574a7eaa04bb9ae1ef62b6 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Thu, 12 Feb 2015 16:38:00 -0800 |
||||
Subject: [PATCH] iscsid: don't re-read config file for every session logout |
||||
|
||||
Follow up to the safe_logout feature patch. |
||||
Cache the safe_logout setting when iscsid is started. |
||||
|
||||
Signed-off-by: Chris Leech <cleech@redhat.com> |
||||
--- |
||||
usr/initiator.c | 6 +----- |
||||
usr/iscsid.c | 6 ++++++ |
||||
usr/iscsid.h | 1 + |
||||
3 files changed, 8 insertions(+), 5 deletions(-) |
||||
|
||||
diff --git a/usr/initiator.c b/usr/initiator.c |
||||
index 2f17882..b25ded8 100644 |
||||
--- a/usr/initiator.c |
||||
+++ b/usr/initiator.c |
||||
@@ -2333,7 +2333,6 @@ int session_logout_task(int sid, queue_task_t *qtask) |
||||
iscsi_session_t *session; |
||||
iscsi_conn_t *conn; |
||||
int rc = ISCSI_SUCCESS; |
||||
- char *safe; |
||||
|
||||
session = session_find_by_sid(sid); |
||||
if (!session) { |
||||
@@ -2356,14 +2355,11 @@ invalid_state: |
||||
return ISCSI_ERR_INTERNAL; |
||||
} |
||||
|
||||
- safe = cfg_get_string_param(dconfig->config_file, "iscsid.safe_logout"); |
||||
- if (safe && !strcmp(safe, "Yes") && session_in_use(sid)) { |
||||
+ if (dconfig->safe_logout && session_in_use(sid)) { |
||||
log_error("Session is actively in use for mounted storage, " |
||||
"and iscsid.safe_logout is configured.\n"); |
||||
- free(safe); |
||||
return ISCSI_ERR_BUSY; |
||||
} |
||||
- free(safe); |
||||
|
||||
/* FIXME: logout all active connections */ |
||||
conn = &session->conn[0]; |
||||
diff --git a/usr/iscsid.c b/usr/iscsid.c |
||||
index f4f4f38..033a71f 100644 |
||||
--- a/usr/iscsid.c |
||||
+++ b/usr/iscsid.c |
||||
@@ -341,6 +341,7 @@ int main(int argc, char *argv[]) |
||||
char *config_file = CONFIG_FILE; |
||||
char *initiatorname_file = INITIATOR_NAME_FILE; |
||||
char *pid_file = PID_FILE; |
||||
+ char *safe_logout; |
||||
int ch, longindex; |
||||
uid_t uid = 0; |
||||
struct sigaction sa_old; |
||||
@@ -520,6 +521,11 @@ int main(int argc, char *argv[]) |
||||
daemon_config.initiator_name : "NOT SET"); |
||||
log_debug(1, "InitiatorAlias=%s", daemon_config.initiator_alias); |
||||
|
||||
+ safe_logout = cfg_get_string_param(config_file, "iscsid.safe_logout"); |
||||
+ if (safe_logout && !strcmp(safe_logout, "Yes")) |
||||
+ daemon_config.safe_logout = 1; |
||||
+ free(safe_logout); |
||||
+ |
||||
pid = fork(); |
||||
if (pid == 0) { |
||||
int nr_found = 0; |
||||
diff --git a/usr/iscsid.h b/usr/iscsid.h |
||||
index 15f264f..b9f3d54 100644 |
||||
--- a/usr/iscsid.h |
||||
+++ b/usr/iscsid.h |
||||
@@ -29,6 +29,7 @@ struct iscsi_daemon_config { |
||||
char *pid_file; |
||||
char *initiator_name; |
||||
char *initiator_alias; |
||||
+ int safe_logout; |
||||
}; |
||||
extern struct iscsi_daemon_config *dconfig; |
||||
|
||||
-- |
||||
2.1.0 |
||||
|
@ -0,0 +1,238 @@
@@ -0,0 +1,238 @@
|
||||
From 2c50348a9f93ef81c30d898b5ab8f1e36b927003 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Thu, 18 Aug 2016 13:06:16 -0700 |
||||
Subject: [PATCH] Revert "ISCSIUIO: Fixed a pthread resc leak from excessive |
||||
session recovery" |
||||
|
||||
This reverts commit fabe160ee191fb57f826d991bcb433dd2467fdc9. |
||||
--- |
||||
iscsiuio/RELEASE.TXT | 12 ------------ |
||||
iscsiuio/src/unix/iscsid_ipc.c | 26 +++++++++++++------------- |
||||
iscsiuio/src/unix/main.c | 5 +---- |
||||
iscsiuio/src/unix/nic.c | 23 +++++++++++++++++++++-- |
||||
iscsiuio/src/unix/nic_utils.c | 5 +---- |
||||
5 files changed, 36 insertions(+), 35 deletions(-) |
||||
|
||||
diff --git a/iscsiuio/RELEASE.TXT b/iscsiuio/RELEASE.TXT |
||||
index 44d67f9..19ef717 100644 |
||||
--- a/iscsiuio/RELEASE.TXT |
||||
+++ b/iscsiuio/RELEASE.TXT |
||||
@@ -11,18 +11,6 @@ |
||||
Copyright (c) 2014, QLogic Corporation |
||||
All rights reserved |
||||
|
||||
-uIP v0.7.10.2 (Feb 12, 2014) |
||||
-======================================================= |
||||
- Fixes |
||||
- ----- |
||||
- 1. Problem: Cont00072504 - ifconfig shows allocation failure after |
||||
- up/down few hours with iSCSI + L2 traffic |
||||
- Cause: A memory leak was discovered in the ongoing pthread creation |
||||
- destruction code during the connection recovery process |
||||
- Change: Fixed the pthread creation code |
||||
- Impact: All |
||||
- |
||||
- |
||||
uIP v0.7.8.2 (Dec 10, 2013) |
||||
======================================================= |
||||
Fixes |
||||
diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c |
||||
index a2a59a8..7790dc5 100644 |
||||
--- a/iscsiuio/src/unix/iscsid_ipc.c |
||||
+++ b/iscsiuio/src/unix/iscsid_ipc.c |
||||
@@ -396,9 +396,9 @@ static int parse_iface(void *arg, int do_ping) |
||||
char ipv6_buf_str[INET6_ADDRSTRLEN]; |
||||
int request_type = 0; |
||||
struct iface_rec *rec; |
||||
+ void *res; |
||||
struct iface_rec_decode ird; |
||||
struct in_addr src_match, dst_match; |
||||
- pthread_attr_t attr; |
||||
struct ping_conf *png_c; |
||||
|
||||
data = (iscsid_uip_broadcast_t *) arg; |
||||
@@ -665,9 +665,7 @@ static int parse_iface(void *arg, int do_ping) |
||||
|
||||
nic_iface->flags |= NIC_IFACE_PATHREQ_WAIT1; |
||||
if (nic->nl_process_thread == INVALID_THREAD) { |
||||
- pthread_attr_init(&attr); |
||||
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); |
||||
- rc = pthread_create(&nic->nl_process_thread, &attr, |
||||
+ rc = pthread_create(&nic->nl_process_thread, NULL, |
||||
nl_process_handle_thread, nic); |
||||
if (rc != 0) { |
||||
LOG_ERR(PFX "%s: Could not create NIC NL " |
||||
@@ -818,16 +816,14 @@ enable_nic: |
||||
case NIC_STOPPED: |
||||
/* This thread will be thrown away when completed */ |
||||
if (nic->enable_thread != INVALID_THREAD) { |
||||
- rc = pthread_cancel(nic->enable_thread); |
||||
+ rc = pthread_join(nic->enable_thread, &res); |
||||
if (rc != 0) { |
||||
- LOG_INFO(PFX "%s: failed to cancel enable NIC " |
||||
+ LOG_INFO(PFX "%s: failed joining enable NIC " |
||||
"thread\n", nic->log_name); |
||||
goto eagain; |
||||
} |
||||
} |
||||
- pthread_attr_init(&attr); |
||||
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); |
||||
- rc = pthread_create(&nic->enable_thread, &attr, |
||||
+ rc = pthread_create(&nic->enable_thread, NULL, |
||||
enable_nic_thread, (void *)nic); |
||||
if (rc != 0) |
||||
LOG_WARN(PFX "%s: failed starting enable NIC thread\n", |
||||
@@ -1169,12 +1165,9 @@ error: |
||||
*/ |
||||
int iscsid_start() |
||||
{ |
||||
- pthread_attr_t attr; |
||||
int rc; |
||||
|
||||
- pthread_attr_init(&attr); |
||||
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); |
||||
- rc = pthread_create(&iscsid_opts.thread, &attr, iscsid_loop, NULL); |
||||
+ rc = pthread_create(&iscsid_opts.thread, NULL, iscsid_loop, NULL); |
||||
if (rc != 0) { |
||||
LOG_ERR(PFX "Could not start iscsid listening thread rc=%d", |
||||
rc); |
||||
@@ -1197,6 +1190,7 @@ error: |
||||
void iscsid_cleanup() |
||||
{ |
||||
int rc; |
||||
+ void *res; |
||||
|
||||
if (iscsid_opts.fd != INVALID_FD) { |
||||
rc = pthread_cancel(iscsid_opts.thread); |
||||
@@ -1204,6 +1198,12 @@ void iscsid_cleanup() |
||||
LOG_ERR("Could not cancel iscsid listening thread: %s", |
||||
strerror(rc)); |
||||
} |
||||
+ |
||||
+ rc = pthread_join(iscsid_opts.thread, &res); |
||||
+ if (rc != 0) { |
||||
+ LOG_ERR("Could not wait for the iscsid listening " |
||||
+ "thread: %s", strerror(rc)); |
||||
+ } |
||||
} |
||||
|
||||
LOG_INFO(PFX "iscsid listening thread has shutdown"); |
||||
diff --git a/iscsiuio/src/unix/main.c b/iscsiuio/src/unix/main.c |
||||
index c1a72d8..bbf8f9c 100644 |
||||
--- a/iscsiuio/src/unix/main.c |
||||
+++ b/iscsiuio/src/unix/main.c |
||||
@@ -236,7 +236,6 @@ int main(int argc, char *argv[]) |
||||
int fd; |
||||
int foreground = 0; |
||||
pid_t pid; |
||||
- pthread_attr_t attr; |
||||
|
||||
/* Record the start time for the user space daemon */ |
||||
opt.start_time = time(NULL); |
||||
@@ -366,9 +365,7 @@ int main(int argc, char *argv[]) |
||||
rc = pthread_sigmask(SIG_SETMASK, &set, NULL); |
||||
|
||||
/* Spin off the signal handling thread */ |
||||
- pthread_attr_init(&attr); |
||||
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); |
||||
- rc = pthread_create(&signal_thread, &attr, signal_handle_thread, NULL); |
||||
+ rc = pthread_create(&signal_thread, NULL, signal_handle_thread, NULL); |
||||
if (rc != 0) |
||||
LOG_ERR("Could not create signal handling thread"); |
||||
|
||||
diff --git a/iscsiuio/src/unix/nic.c b/iscsiuio/src/unix/nic.c |
||||
index 74b7c5e..0d4965d 100644 |
||||
--- a/iscsiuio/src/unix/nic.c |
||||
+++ b/iscsiuio/src/unix/nic.c |
||||
@@ -465,6 +465,7 @@ int nic_remove(nic_t *nic) |
||||
int rc; |
||||
nic_t *prev, *current; |
||||
struct stat file_stat; |
||||
+ void *res; |
||||
nic_interface_t *nic_iface, *next_nic_iface, *vlan_iface; |
||||
|
||||
pthread_mutex_lock(&nic->nic_mutex); |
||||
@@ -487,6 +488,12 @@ int nic_remove(nic_t *nic) |
||||
LOG_DEBUG(PFX "%s: Couldn't send cancel to nic enable " |
||||
"thread", nic->log_name); |
||||
|
||||
+ LOG_DEBUG(PFX "%s: Waiting to join nic enable thread", |
||||
+ nic->log_name); |
||||
+ rc = pthread_join(nic->enable_thread, &res); |
||||
+ if (rc != 0) |
||||
+ LOG_DEBUG(PFX "%s: Couldn't join to canceled enable " |
||||
+ "nic thread", nic->log_name); |
||||
nic->enable_thread = INVALID_THREAD; |
||||
LOG_DEBUG(PFX "%s: nic enable thread cleaned", nic->log_name); |
||||
} else { |
||||
@@ -502,6 +509,11 @@ int nic_remove(nic_t *nic) |
||||
LOG_DEBUG(PFX "%s: Couldn't send cancel to nic", |
||||
nic->log_name); |
||||
|
||||
+ LOG_DEBUG(PFX "%s: Waiting to join nic thread", nic->log_name); |
||||
+ rc = pthread_join(nic->thread, &res); |
||||
+ if (rc != 0) |
||||
+ LOG_DEBUG(PFX "%s: Couldn't join to canceled nic " |
||||
+ "thread", nic->log_name); |
||||
nic->thread = INVALID_THREAD; |
||||
LOG_DEBUG(PFX "%s: nic thread cleaned", nic->log_name); |
||||
} else { |
||||
@@ -516,6 +528,12 @@ int nic_remove(nic_t *nic) |
||||
LOG_DEBUG(PFX "%s: Couldn't send cancel to nic nl " |
||||
"thread", nic->log_name); |
||||
|
||||
+ LOG_DEBUG(PFX "%s: Waiting to join nic nl thread", |
||||
+ nic->log_name); |
||||
+ rc = pthread_join(nic->nl_process_thread, &res); |
||||
+ if (rc != 0) |
||||
+ LOG_DEBUG(PFX "%s: Couldn't join to canceled nic nl " |
||||
+ "thread", nic->log_name); |
||||
nic->nl_process_thread = INVALID_THREAD; |
||||
LOG_DEBUG(PFX "%s: nic nl thread cleaned", nic->log_name); |
||||
} else { |
||||
@@ -1236,6 +1254,7 @@ static int do_acquisition(nic_t *nic, nic_interface_t *nic_iface, |
||||
{ |
||||
struct in_addr addr; |
||||
struct in6_addr addr6; |
||||
+ void *res; |
||||
char buf[INET6_ADDRSTRLEN]; |
||||
int rc = -1; |
||||
|
||||
@@ -1309,9 +1328,9 @@ static int do_acquisition(nic_t *nic, nic_interface_t *nic_iface, |
||||
if (nic->enable_thread == INVALID_THREAD) |
||||
goto dhcp_err; |
||||
|
||||
- rc = pthread_cancel(nic->enable_thread); |
||||
+ rc = pthread_join(nic->enable_thread, &res); |
||||
if (rc != 0) |
||||
- LOG_ERR(PFX "%s: Couldn't cancel " |
||||
+ LOG_ERR(PFX "%s: Couldn't join to canceled " |
||||
"enable nic thread", nic->log_name); |
||||
dhcp_err: |
||||
pthread_mutex_lock(&nic->nic_mutex); |
||||
diff --git a/iscsiuio/src/unix/nic_utils.c b/iscsiuio/src/unix/nic_utils.c |
||||
index 0daffd2..cbed986 100644 |
||||
--- a/iscsiuio/src/unix/nic_utils.c |
||||
+++ b/iscsiuio/src/unix/nic_utils.c |
||||
@@ -893,7 +893,6 @@ error: |
||||
|
||||
void prepare_nic_thread(nic_t *nic) |
||||
{ |
||||
- pthread_attr_t attr; |
||||
int rc; |
||||
|
||||
pthread_mutex_lock(&nic->nic_mutex); |
||||
@@ -904,9 +903,7 @@ void prepare_nic_thread(nic_t *nic) |
||||
LOG_INFO(PFX "%s: spinning up thread for nic", nic->log_name); |
||||
|
||||
/* Try to spin up the nic thread */ |
||||
- pthread_attr_init(&attr); |
||||
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); |
||||
- rc = pthread_create(&nic->thread, &attr, nic_loop, nic); |
||||
+ rc = pthread_create(&nic->thread, NULL, nic_loop, nic); |
||||
if (rc != 0) { |
||||
LOG_ERR(PFX "%s: Couldn't create thread for nic", |
||||
nic->log_name); |
||||
-- |
||||
2.5.5 |
||||
|
@ -0,0 +1,47 @@
@@ -0,0 +1,47 @@
|
||||
From b6c9ebe86c45d0a318ec9bb42a6373b4f77a1ba7 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Tue, 21 Jul 2015 16:15:30 -0700 |
||||
Subject: [PATCH 1/1] fix device path canonicalization by using libmount cache |
||||
|
||||
--- |
||||
usr/initiator.c | 9 +++++++-- |
||||
1 file changed, 7 insertions(+), 2 deletions(-) |
||||
|
||||
diff --git a/usr/initiator.c b/usr/initiator.c |
||||
index 3b39c5d..0519d46 100644 |
||||
--- a/usr/initiator.c |
||||
+++ b/usr/initiator.c |
||||
@@ -2141,12 +2141,14 @@ static int session_unbind(struct iscsi_session *session) |
||||
} |
||||
|
||||
static struct libmnt_table *mtab, *swaps; |
||||
+static struct libmnt_cache *mntcache; |
||||
|
||||
static void libmount_cleanup(void) |
||||
{ |
||||
mnt_free_table(mtab); |
||||
mnt_free_table(swaps); |
||||
- mtab = swaps = NULL; |
||||
+ mnt_free_cache(mntcache); |
||||
+ mtab = swaps = mntcache = NULL; |
||||
} |
||||
|
||||
static int libmount_init(void) |
||||
@@ -2154,10 +2156,13 @@ static int libmount_init(void) |
||||
mnt_init_debug(0); |
||||
mtab = mnt_new_table(); |
||||
swaps = mnt_new_table(); |
||||
- if (!mtab || !swaps) { |
||||
+ mntcache = mnt_new_cache(); |
||||
+ if (!mtab || !swaps || !mntcache) { |
||||
libmount_cleanup(); |
||||
return -ENOMEM; |
||||
} |
||||
+ mnt_table_set_cache(mtab, mntcache); |
||||
+ mnt_table_set_cache(swaps, mntcache); |
||||
mnt_table_parse_mtab(mtab, NULL); |
||||
mnt_table_parse_swaps(swaps, NULL); |
||||
return 0; |
||||
-- |
||||
2.1.0 |
||||
|
@ -0,0 +1,29 @@
@@ -0,0 +1,29 @@
|
||||
From 3f15a2270a7efb1a6ee8ef555b01f3d8674818b9 Mon Sep 17 00:00:00 2001 |
||||
From: Lee Duncan <leeman.duncan@gmail.com> |
||||
Date: Fri, 10 Jul 2015 11:58:55 -0700 |
||||
Subject: iBFT 'origin' is an enum, not a string |
||||
|
||||
A recent change, commit 4959a89f421fdebc, modified open-iscsi |
||||
to treat the "origin" field as an enum, not a character |
||||
string. But one spot was missed. |
||||
--- |
||||
utils/fwparam_ibft/fwparam_ibft_sysfs.c | 3 +-- |
||||
1 file changed, 1 insertion(+), 2 deletions(-) |
||||
|
||||
diff --git a/utils/fwparam_ibft/fwparam_ibft_sysfs.c b/utils/fwparam_ibft/fwparam_ibft_sysfs.c |
||||
index 2dc6f6d5fe54..019fc19184bb 100644 |
||||
--- a/utils/fwparam_ibft/fwparam_ibft_sysfs.c |
||||
+++ b/utils/fwparam_ibft/fwparam_ibft_sysfs.c |
||||
@@ -201,8 +201,7 @@ static int fill_nic_context(char *id, struct boot_context *context) |
||||
sizeof(context->secondary_dns)); |
||||
sysfs_get_str(id, IBFT_SUBSYS, "dhcp", context->dhcp, |
||||
sizeof(context->dhcp)); |
||||
- sysfs_get_str(id, IBFT_SUBSYS, "origin", context->origin, |
||||
- sizeof(context->origin)); |
||||
+ sysfd_get_int(id, IBFT_SUBSYS, "origin", &context->origin); |
||||
return 0; |
||||
} |
||||
|
||||
-- |
||||
2.9.3 |
||||
|
@ -0,0 +1,62 @@
@@ -0,0 +1,62 @@
|
||||
From d5483b0df96bd2a1cf86039cf4c6822ec7d7f609 Mon Sep 17 00:00:00 2001 |
||||
From: Gorka Eguileor <geguileo@redhat.com> |
||||
Date: Fri, 17 Mar 2017 16:00:11 +0100 |
||||
Subject: Fix manual LUN scans feature |
||||
|
||||
The newly introduced feature to disable automatic scans should not be |
||||
scanning *any* of the LUNs when the scan is set to manual, but it always |
||||
scans for LUN0. |
||||
|
||||
This patch fixes this by skipping the sysfs call altogether, as it |
||||
should have been doing from the start. |
||||
--- |
||||
usr/iscsi_sysfs.c | 13 +++++++------ |
||||
usr/iscsi_sysfs.h | 2 +- |
||||
2 files changed, 8 insertions(+), 7 deletions(-) |
||||
|
||||
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c |
||||
index 2f94b632baaa..0cc55b97bde9 100644 |
||||
--- a/usr/iscsi_sysfs.c |
||||
+++ b/usr/iscsi_sysfs.c |
||||
@@ -1883,18 +1883,19 @@ void iscsi_sysfs_rescan_device(void *data, int hostno, int target, int lun) |
||||
strlen(write_buf)); |
||||
} |
||||
|
||||
-pid_t iscsi_sysfs_scan_host(int hostno, int async, int full_scan) |
||||
+pid_t iscsi_sysfs_scan_host(int hostno, int async, int autoscan) |
||||
{ |
||||
char id[NAME_SIZE]; |
||||
- char write_buf[6] = "- - 0"; |
||||
+ char *write_buf = "- - -"; |
||||
pid_t pid = 0; |
||||
|
||||
- if (full_scan) |
||||
- write_buf[4] = '-'; |
||||
- |
||||
if (async) |
||||
pid = fork(); |
||||
- if (pid == 0) { |
||||
+ |
||||
+ if (pid >= 0 && !autoscan) { |
||||
+ if (pid) |
||||
+ log_debug(4, "host%d in manual scan mode, skipping scan", hostno); |
||||
+ } else if (pid == 0) { |
||||
/* child */ |
||||
log_debug(4, "scanning host%d", hostno); |
||||
|
||||
diff --git a/usr/iscsi_sysfs.h b/usr/iscsi_sysfs.h |
||||
index 3492ce6e033c..cdcefa65f683 100644 |
||||
--- a/usr/iscsi_sysfs.h |
||||
+++ b/usr/iscsi_sysfs.h |
||||
@@ -87,7 +87,7 @@ extern void iscsi_sysfs_get_negotiated_session_conf(int sid, |
||||
struct iscsi_session_operational_config *conf); |
||||
extern void iscsi_sysfs_get_negotiated_conn_conf(int sid, |
||||
struct iscsi_conn_operational_config *conf); |
||||
-extern pid_t iscsi_sysfs_scan_host(int hostno, int async, int full); |
||||
+extern pid_t iscsi_sysfs_scan_host(int hostno, int async, int autoscan); |
||||
extern int iscsi_sysfs_get_session_state(char *state, int sid); |
||||
extern int iscsi_sysfs_get_host_state(char *state, int host_no); |
||||
extern int iscsi_sysfs_get_device_state(char *state, int host_no, int target, |
||||
-- |
||||
2.9.3 |
||||
|
@ -0,0 +1,28 @@
@@ -0,0 +1,28 @@
|
||||
From f910837dace250418cba4155a6708d47d45075cc Mon Sep 17 00:00:00 2001 |
||||
From: Nilesh Javili <nilesh.javali@cavium.com> |
||||
Date: Thu, 27 Apr 2017 17:59:00 -0700 |
||||
Subject: iscsid: Add qedi ping transport hook |
||||
|
||||
iscsiuio ping is operational for qedi. |
||||
Add missing qedi transport hook for ping support. |
||||
|
||||
Signed-off-by: Nilesh Javali <nilesh.javali@cavium.com> |
||||
--- |
||||
usr/transport.c | 1 + |
||||
1 file changed, 1 insertion(+) |
||||
|
||||
diff --git a/usr/transport.c b/usr/transport.c |
||||
index 533ba30a8846..3b7a00a2245e 100644 |
||||
--- a/usr/transport.c |
||||
+++ b/usr/transport.c |
||||
@@ -124,6 +124,7 @@ struct iscsi_transport_template qedi = { |
||||
.ep_poll = ktransport_ep_poll, |
||||
.ep_disconnect = ktransport_ep_disconnect, |
||||
.set_net_config = uip_broadcast_params, |
||||
+ .exec_ping = uip_broadcast_ping_req, |
||||
}; |
||||
|
||||
static struct iscsi_transport_template *iscsi_transport_templates[] = { |
||||
-- |
||||
2.9.3 |
||||
|
@ -0,0 +1,111 @@
@@ -0,0 +1,111 @@
|
||||
From 2a463c04a75726e811161f435e2f6736d70a66bd Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Tue, 20 Jun 2017 09:35:23 -0700 |
||||
Subject: isolate iscsistart socket use |
||||
|
||||
--- |
||||
usr/iscsid_req.c | 12 +++++++++++- |
||||
usr/iscsid_req.h | 3 +++ |
||||
usr/iscsistart.c | 6 ++++++ |
||||
usr/mgmt_ipc.c | 3 ++- |
||||
usr/mgmt_ipc.h | 1 - |
||||
5 files changed, 22 insertions(+), 3 deletions(-) |
||||
|
||||
diff --git a/usr/iscsid_req.c b/usr/iscsid_req.c |
||||
index 2950d748c644..69351c6c61ea 100644 |
||||
--- a/usr/iscsid_req.c |
||||
+++ b/usr/iscsid_req.c |
||||
@@ -96,9 +96,19 @@ static int ipc_connect(int *fd, char *unix_sock_name, int start_iscsid) |
||||
return ISCSI_ERR_ISCSID_NOTCONN; |
||||
} |
||||
|
||||
+char iscsid_namespace[64] = ISCSIADM_NAMESPACE; |
||||
+ |
||||
+void iscsid_set_namespace(pid_t pid) { |
||||
+ if (pid) { |
||||
+ snprintf(iscsid_namespace, 64, ISCSIADM_NAMESPACE "-%d", pid); |
||||
+ } else { |
||||
+ snprintf(iscsid_namespace, 64, ISCSIADM_NAMESPACE); |
||||
+ } |
||||
+} |
||||
+ |
||||
static int iscsid_connect(int *fd, int start_iscsid) |
||||
{ |
||||
- return ipc_connect(fd, ISCSIADM_NAMESPACE, start_iscsid); |
||||
+ return ipc_connect(fd, iscsid_namespace, start_iscsid); |
||||
} |
||||
|
||||
int iscsid_request(int *fd, iscsiadm_req_t *req, int start_iscsid) |
||||
diff --git a/usr/iscsid_req.h b/usr/iscsid_req.h |
||||
index 8cb4a922f46d..ba7b2357c729 100644 |
||||
--- a/usr/iscsid_req.h |
||||
+++ b/usr/iscsid_req.h |
||||
@@ -25,6 +25,9 @@ struct iscsiadm_req; |
||||
struct iscsiadm_rsp; |
||||
struct node_rec; |
||||
|
||||
+extern char iscsid_namespace[64]; |
||||
+extern void iscsid_set_namespace(pid_t); |
||||
+ |
||||
extern int iscsid_exec_req(struct iscsiadm_req *req, struct iscsiadm_rsp *rsp, |
||||
int iscsid_start); |
||||
extern int iscsid_req_wait(int cmd, int fd); |
||||
diff --git a/usr/iscsistart.c b/usr/iscsistart.c |
||||
index ecb256b3c2f6..538dd2f9d780 100644 |
||||
--- a/usr/iscsistart.c |
||||
+++ b/usr/iscsistart.c |
||||
@@ -458,6 +458,10 @@ int main(int argc, char *argv[]) |
||||
} else if (pid) { |
||||
int status, rc, rc2; |
||||
|
||||
+ /* make a special socket path for only this iscsistart instance */ |
||||
+ iscsid_set_namespace(pid); |
||||
+ sleep(1); |
||||
+ |
||||
rc = setup_session(); |
||||
rc2 = stop_event_loop(); |
||||
/* |
||||
@@ -475,6 +478,9 @@ int main(int argc, char *argv[]) |
||||
exit(0); |
||||
} |
||||
|
||||
+ pid = getpid(); |
||||
+ iscsid_set_namespace(pid); |
||||
+ |
||||
mgmt_ipc_fd = mgmt_ipc_listen(); |
||||
if (mgmt_ipc_fd < 0) { |
||||
log_error("Could not setup mgmt ipc"); |
||||
diff --git a/usr/mgmt_ipc.c b/usr/mgmt_ipc.c |
||||
index c16bce962232..140d358ec5da 100644 |
||||
--- a/usr/mgmt_ipc.c |
||||
+++ b/usr/mgmt_ipc.c |
||||
@@ -37,6 +37,7 @@ |
||||
#include "iscsi_ipc.h" |
||||
#include "iscsi_err.h" |
||||
#include "iscsi_util.h" |
||||
+#include "iscsid_req.h" |
||||
|
||||
#define PEERUSER_MAX 64 |
||||
#define EXTMSG_MAX (64 * 1024) |
||||
@@ -60,7 +61,7 @@ mgmt_ipc_listen(void) |
||||
return fd; |
||||
} |
||||
|
||||
- addr_len = setup_abstract_addr(&addr, ISCSIADM_NAMESPACE); |
||||
+ addr_len = setup_abstract_addr(&addr, iscsid_namespace); |
||||
|
||||
if ((err = bind(fd, (struct sockaddr *) &addr, addr_len)) < 0 ) { |
||||
log_error("Can not bind IPC socket"); |
||||
diff --git a/usr/mgmt_ipc.h b/usr/mgmt_ipc.h |
||||
index 55972ed793a1..b6b836fc07c1 100644 |
||||
--- a/usr/mgmt_ipc.h |
||||
+++ b/usr/mgmt_ipc.h |
||||
@@ -115,5 +115,4 @@ int mgmt_ipc_listen(void); |
||||
int mgmt_ipc_systemd(void); |
||||
void mgmt_ipc_close(int fd); |
||||
void mgmt_ipc_handle(int accept_fd); |
||||
- |
||||
#endif /* MGMT_IPC_H */ |
||||
-- |
||||
2.9.4 |
||||
|
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
From c3122e9aedc4ebb49090df86e6f53806fed6cebc Mon Sep 17 00:00:00 2001 |
||||
From: Lee Duncan <lduncan@suse.com> |
||||
Date: Wed, 23 Nov 2016 14:50:35 -0800 |
||||
Subject: iscsid: treat SIGTERM like "iscsiadm -k 0" |
||||
|
||||
The same code that is executed by iscsid |
||||
when iscsiadm sends the "immediate stop" |
||||
command should be executed when iscsid |
||||
receives a SIGTERM. |
||||
|
||||
Changes since v1: |
||||
* now just set the "event loop stop" flag |
||||
|
||||
Signed-off-by: Lee Duncan <lduncan@suse.com> |
||||
--- |
||||
usr/iscsid.c | 3 +-- |
||||
1 file changed, 1 insertion(+), 2 deletions(-) |
||||
|
||||
diff --git a/usr/iscsid.c b/usr/iscsid.c |
||||
index 0c2634448d09..81a14f259b5f 100644 |
||||
--- a/usr/iscsid.c |
||||
+++ b/usr/iscsid.c |
||||
@@ -313,8 +313,7 @@ static void catch_signal(int signo) |
||||
|
||||
switch (signo) { |
||||
case SIGTERM: |
||||
- iscsid_shutdown(); |
||||
- exit(0); |
||||
+ event_loop_exit(NULL); |
||||
break; |
||||
default: |
||||
break; |
||||
-- |
||||
2.9.3 |
||||
|
@ -0,0 +1,33 @@
@@ -0,0 +1,33 @@
|
||||
From 3951c242d266689a8c856717b02b07c1fe193a31 Mon Sep 17 00:00:00 2001 |
||||
From: Lee Duncan <lduncan@suse.com> |
||||
Date: Fri, 2 Dec 2016 09:22:02 -0800 |
||||
Subject: Make event_loop_stop volatile for safer access |
||||
|
||||
As suggested by Christian Seiler: |
||||
"Only minor thing is that you might want to mark |
||||
static int event_loop_stop; (usr/event_poll.c) |
||||
to be volatile, to be on the safe side when modifying it |
||||
from within a signal handler. Probably not really required |
||||
here (the compiler is not allowed to optimize out the |
||||
access anyway, since you call non-static functions within |
||||
the loop), but it doesn't hurt either, just in case... " |
||||
--- |
||||
usr/event_poll.c | 2 +- |
||||
1 file changed, 1 insertion(+), 1 deletion(-) |
||||
|
||||
diff --git a/usr/event_poll.c b/usr/event_poll.c |
||||
index 209ee0280c0a..ac2504404366 100644 |
||||
--- a/usr/event_poll.c |
||||
+++ b/usr/event_poll.c |
||||
@@ -123,7 +123,7 @@ static int shutdown_wait_pids(void) |
||||
#define POLL_ALARM 2 |
||||
#define POLL_MAX 3 |
||||
|
||||
-static int event_loop_stop; |
||||
+static volatile int event_loop_stop; |
||||
static queue_task_t *shutdown_qtask; |
||||
|
||||
void event_loop_exit(queue_task_t *qtask) |
||||
-- |
||||
2.9.3 |
||||
|
@ -0,0 +1,265 @@
@@ -0,0 +1,265 @@
|
||||
From 5e32aea95741a07d53153c658a0572588eae494d Mon Sep 17 00:00:00 2001 |
||||
From: Gorka Eguileor <geguileo@redhat.com> |
||||
Date: Tue, 21 Feb 2017 20:01:39 +0100 |
||||
Subject: Allow disabling auto LUN scans |
||||
|
||||
Existing behavior of auto scanning LUNs is problematic for some |
||||
deployments, particularly in cases where we are: |
||||
|
||||
- Accessing different LUNs from the same target on different machines |
||||
and we don't want the other LUNs automatically exposed in other |
||||
systems. |
||||
|
||||
- LUNs are constantly being created and removed from the target by |
||||
another machine and we don't want our systems polluted by no longer |
||||
available logical units, since default udev rules don't remove them |
||||
automatically from the system once they have been added automatically. |
||||
|
||||
This is a little more problematic when working with multipaths as we end |
||||
up with a lot of leftover device maps. |
||||
|
||||
This patch introduces a new configuration option at the session level |
||||
called "scan", with "auto" and "manual" as acceptable values, that |
||||
allows us to disable the autoscan in the following cases: |
||||
|
||||
- On iscsid start |
||||
- On login |
||||
- On AEN/AER messages reporting LUNs data has changed. |
||||
|
||||
For HW drivers all sessions will use the value defined in the |
||||
configuration file. |
||||
|
||||
Default value for this new option is "auto" to maintain existing |
||||
behavior. |
||||
--- |
||||
etc/iscsid.conf | 8 ++++++++ |
||||
usr/config.h | 1 + |
||||
usr/idbm.c | 14 +++++++++++++- |
||||
usr/idbm.h | 1 + |
||||
usr/idbm_fields.h | 1 + |
||||
usr/initiator.c | 5 +++-- |
||||
usr/iscsi_settings.h | 3 +++ |
||||
usr/iscsi_sysfs.c | 7 +++++-- |
||||
usr/iscsi_sysfs.h | 2 +- |
||||
usr/iscsiadm.c | 2 +- |
||||
usr/iscsid.c | 2 +- |
||||
usr/iscsistart.c | 3 +++ |
||||
12 files changed, 41 insertions(+), 8 deletions(-) |
||||
|
||||
diff --git a/etc/iscsid.conf b/etc/iscsid.conf |
||||
index f7ecb6b3c2ab..cb77a777062d 100644 |
||||
--- a/etc/iscsid.conf |
||||
+++ b/etc/iscsid.conf |
||||
@@ -305,3 +305,11 @@ node.session.iscsi.FastAbort = Yes |
||||
# a task management function like an ABORT TASK or LOGICAL UNIT RESET, that |
||||
# it continue to respond to R2Ts. To enable this uncomment this line |
||||
# node.session.iscsi.FastAbort = No |
||||
+ |
||||
+# To prevent doing automatic scans that would add unwanted luns to the system |
||||
+# we can disable them and have sessions only do manually requested scans. |
||||
+# Automatic scans are performed on startup, on login, and on AEN/AER reception |
||||
+# on devices supporting it. For HW drivers all sessions will use the value |
||||
+# defined in the configuration file. This configuration option is independent |
||||
+# of scsi_mod scan parameter. (The default behavior is auto): |
||||
+node.session.scan = auto |
||||
diff --git a/usr/config.h b/usr/config.h |
||||
index 5b1bb1d624c5..3bcb93fe7322 100644 |
||||
--- a/usr/config.h |
||||
+++ b/usr/config.h |
||||
@@ -190,6 +190,7 @@ typedef struct session_rec { |
||||
int queue_depth; |
||||
int initial_login_retry_max; |
||||
int nr_sessions; |
||||
+ int scan; |
||||
struct iscsi_auth_config auth; |
||||
struct iscsi_session_timeout_config timeo; |
||||
struct iscsi_error_timeout_config err_timeo; |
||||
diff --git a/usr/idbm.c b/usr/idbm.c |
||||
index 3b8a5a20bec8..ff8d67f64c51 100644 |
||||
--- a/usr/idbm.c |
||||
+++ b/usr/idbm.c |
||||
@@ -462,6 +462,9 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri) |
||||
session.iscsi.MaxOutstandingR2T, IDBM_SHOW, num, 1); |
||||
__recinfo_int(SESSION_ERL, ri, r, |
||||
session.iscsi.ERL, IDBM_SHOW, num, 1); |
||||
+ __recinfo_int_o2(SESSION_SCAN, ri, r, |
||||
+ session.scan, IDBM_SHOW, "manual", "auto", |
||||
+ num, 1); |
||||
|
||||
for (i = 0; i < ISCSI_CONN_MAX; i++) { |
||||
char key[NAME_MAXVAL]; |
||||
@@ -2490,7 +2493,7 @@ static void idbm_rm_disc_node_links(char *disc_dir) |
||||
log_debug(5, "disc removal removing link %s %s %s %s", |
||||
target, address, port, iface_id); |
||||
|
||||
- memset(rec, 0, sizeof(*rec)); |
||||
+ memset(rec, 0, sizeof(*rec)); |
||||
strlcpy(rec->name, target, TARGET_NAME_MAXLEN); |
||||
rec->tpgt = atoi(tpgt); |
||||
rec->conn[0].port = atoi(port); |
||||
@@ -2726,6 +2729,14 @@ idbm_slp_defaults(struct iscsi_slp_config *cfg) |
||||
sizeof(struct iscsi_slp_config)); |
||||
} |
||||
|
||||
+int |
||||
+idbm_session_autoscan(struct iscsi_session *session) |
||||
+{ |
||||
+ if (session) |
||||
+ return session->nrec.session.scan; |
||||
+ return db->nrec.session.scan; |
||||
+} |
||||
+ |
||||
struct user_param *idbm_alloc_user_param(char *name, char *value) |
||||
{ |
||||
struct user_param *param; |
||||
@@ -2981,6 +2992,7 @@ void idbm_node_setup_defaults(node_rec_t *rec) |
||||
rec->session.info = NULL; |
||||
rec->session.sid = 0; |
||||
rec->session.multiple = 0; |
||||
+ rec->session.scan = DEF_INITIAL_SCAN; |
||||
idbm_setup_session_defaults(&rec->session.iscsi); |
||||
|
||||
for (i=0; i<ISCSI_CONN_MAX; i++) { |
||||
diff --git a/usr/idbm.h b/usr/idbm.h |
||||
index b9020fe4fd0a..411dd8230ece 100644 |
||||
--- a/usr/idbm.h |
||||
+++ b/usr/idbm.h |
||||
@@ -140,6 +140,7 @@ extern int idbm_add_discovery(discovery_rec_t *newrec); |
||||
extern void idbm_sendtargets_defaults(struct iscsi_sendtargets_config *cfg); |
||||
extern void idbm_isns_defaults(struct iscsi_isns_config *cfg); |
||||
extern void idbm_slp_defaults(struct iscsi_slp_config *cfg); |
||||
+extern int idbm_session_autoscan(struct iscsi_session *session); |
||||
extern int idbm_discovery_read(discovery_rec_t *rec, int type, char *addr, |
||||
int port); |
||||
extern int idbm_rec_read(node_rec_t *out_rec, char *target_name, |
||||
diff --git a/usr/idbm_fields.h b/usr/idbm_fields.h |
||||
index 5790a033d241..4a927584c2fc 100644 |
||||
--- a/usr/idbm_fields.h |
||||
+++ b/usr/idbm_fields.h |
||||
@@ -45,6 +45,7 @@ |
||||
#define SESSION_MAX_CONNS "node.session.iscsi.MaxConnections" |
||||
#define SESSION_MAX_R2T "node.session.iscsi.MaxOutstandingR2T" |
||||
#define SESSION_ERL "node.session.iscsi.ERL" |
||||
+#define SESSION_SCAN "node.session.scan" |
||||
|
||||
/* connections fields */ |
||||
#define CONN_ADDR "node.conn[%d].address" |
||||
diff --git a/usr/initiator.c b/usr/initiator.c |
||||
index ed174b5af38f..a86d1e6dee90 100644 |
||||
--- a/usr/initiator.c |
||||
+++ b/usr/initiator.c |
||||
@@ -997,7 +997,7 @@ static void session_scan_host(struct iscsi_session *session, int hostno, |
||||
{ |
||||
pid_t pid; |
||||
|
||||
- pid = iscsi_sysfs_scan_host(hostno, 1); |
||||
+ pid = iscsi_sysfs_scan_host(hostno, 1, idbm_session_autoscan(session)); |
||||
if (pid == 0) { |
||||
mgmt_ipc_write_rsp(qtask, ISCSI_SUCCESS); |
||||
|
||||
@@ -1201,7 +1201,8 @@ static void iscsi_recv_async_msg(iscsi_conn_t *conn, struct iscsi_hdr *hdr) |
||||
break; |
||||
} |
||||
|
||||
- if (sshdr.asc == 0x3f && sshdr.ascq == 0x0e) |
||||
+ if (sshdr.asc == 0x3f && sshdr.ascq == 0x0e |
||||
+ && idbm_session_autoscan(session)) |
||||
session_scan_host(session, session->hostno, NULL); |
||||
break; |
||||
case ISCSI_ASYNC_MSG_REQUEST_LOGOUT: |
||||
diff --git a/usr/iscsi_settings.h b/usr/iscsi_settings.h |
||||
index 3d923c8ba029..296ff403b1e5 100644 |
||||
--- a/usr/iscsi_settings.h |
||||
+++ b/usr/iscsi_settings.h |
||||
@@ -45,3 +45,6 @@ |
||||
|
||||
/* login retries */ |
||||
#define DEF_INITIAL_LOGIN_RETRIES_MAX 4 |
||||
+ |
||||
+/* autoscan enabled */ |
||||
+#define DEF_INITIAL_SCAN 1 |
||||
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c |
||||
index 8ca668fdb3bc..2f94b632baaa 100644 |
||||
--- a/usr/iscsi_sysfs.c |
||||
+++ b/usr/iscsi_sysfs.c |
||||
@@ -1883,12 +1883,15 @@ void iscsi_sysfs_rescan_device(void *data, int hostno, int target, int lun) |
||||
strlen(write_buf)); |
||||
} |
||||
|
||||
-pid_t iscsi_sysfs_scan_host(int hostno, int async) |
||||
+pid_t iscsi_sysfs_scan_host(int hostno, int async, int full_scan) |
||||
{ |
||||
char id[NAME_SIZE]; |
||||
- char *write_buf = "- - -"; |
||||
+ char write_buf[6] = "- - 0"; |
||||
pid_t pid = 0; |
||||
|
||||
+ if (full_scan) |
||||
+ write_buf[4] = '-'; |
||||
+ |
||||
if (async) |
||||
pid = fork(); |
||||
if (pid == 0) { |
||||
diff --git a/usr/iscsi_sysfs.h b/usr/iscsi_sysfs.h |
||||
index 9a56105165b3..3492ce6e033c 100644 |
||||
--- a/usr/iscsi_sysfs.h |
||||
+++ b/usr/iscsi_sysfs.h |
||||
@@ -87,7 +87,7 @@ extern void iscsi_sysfs_get_negotiated_session_conf(int sid, |
||||
struct iscsi_session_operational_config *conf); |
||||
extern void iscsi_sysfs_get_negotiated_conn_conf(int sid, |
||||
struct iscsi_conn_operational_config *conf); |
||||
-extern pid_t iscsi_sysfs_scan_host(int hostno, int async); |
||||
+extern pid_t iscsi_sysfs_scan_host(int hostno, int async, int full); |
||||
extern int iscsi_sysfs_get_session_state(char *state, int sid); |
||||
extern int iscsi_sysfs_get_host_state(char *state, int host_no); |
||||
extern int iscsi_sysfs_get_device_state(char *state, int host_no, int target, |
||||
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c |
||||
index 4b2bd34cbb2e..90e2828bcb79 100644 |
||||
--- a/usr/iscsiadm.c |
||||
+++ b/usr/iscsiadm.c |
||||
@@ -773,7 +773,7 @@ static int rescan_portal(void *data, struct session_info *info) |
||||
iscsi_sysfs_for_each_device(NULL, host_no, info->sid, |
||||
iscsi_sysfs_rescan_device); |
||||
/* now scan for new devices */ |
||||
- iscsi_sysfs_scan_host(host_no, 0); |
||||
+ iscsi_sysfs_scan_host(host_no, 0, 1); |
||||
return 0; |
||||
} |
||||
|
||||
diff --git a/usr/iscsid.c b/usr/iscsid.c |
||||
index 81a14f259b5f..813eb3da940d 100644 |
||||
--- a/usr/iscsid.c |
||||
+++ b/usr/iscsid.c |
||||
@@ -216,7 +216,7 @@ static int sync_session(void *data, struct session_info *info) |
||||
iscsi_err_to_str(err)); |
||||
return 0; |
||||
} |
||||
- iscsi_sysfs_scan_host(host_no, 0); |
||||
+ iscsi_sysfs_scan_host(host_no, 0, idbm_session_autoscan(NULL)); |
||||
return 0; |
||||
} |
||||
|
||||
diff --git a/usr/iscsistart.c b/usr/iscsistart.c |
||||
index 5cf09721636b..67ac47515f23 100644 |
||||
--- a/usr/iscsistart.c |
||||
+++ b/usr/iscsistart.c |
||||
@@ -140,6 +140,7 @@ static int apply_params(struct node_rec *rec) |
||||
rec->session.initial_login_retry_max = -1; |
||||
rec->conn[0].timeo.noop_out_interval = -1; |
||||
rec->conn[0].timeo.noop_out_timeout = -1; |
||||
+ rec->session.scan = -1; |
||||
|
||||
list_for_each_entry(param, &user_params, list) { |
||||
/* |
||||
@@ -183,6 +184,8 @@ static int apply_params(struct node_rec *rec) |
||||
rec->conn[0].timeo.noop_out_interval = 0; |
||||
if (rec->conn[0].timeo.noop_out_timeout == -1) |
||||
rec->conn[0].timeo.noop_out_timeout = 0; |
||||
+ if (rec->session.scan == -1) |
||||
+ rec->session.scan = DEF_INITIAL_SCAN; |
||||
|
||||
return 0; |
||||
} |
||||
-- |
||||
2.9.3 |
||||
|
@ -0,0 +1,73 @@
@@ -0,0 +1,73 @@
|
||||
From dc939e78d6dab78f3fcddfada581fa402604bb51 Mon Sep 17 00:00:00 2001 |
||||
From: Nilesh Javali <nilesh.javali@cavium.com> |
||||
Date: Fri, 11 Nov 2016 08:17:50 +0200 |
||||
Subject: iscsid: Changes to support the new qedi transport |
||||
|
||||
Signed-off-by: Manish Rangankar <manish.rangankar@cavium.com> |
||||
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com> |
||||
Signed-off-by: Nilesh Javali <nilesh.javali@cavium.com> |
||||
--- |
||||
usr/initiator_common.c | 2 +- |
||||
usr/transport.c | 13 +++++++++++++ |
||||
usr/transport.h | 1 + |
||||
3 files changed, 15 insertions(+), 1 deletion(-) |
||||
|
||||
diff --git a/usr/initiator_common.c b/usr/initiator_common.c |
||||
index 1d1d82251ad4..191e779bb942 100644 |
||||
--- a/usr/initiator_common.c |
||||
+++ b/usr/initiator_common.c |
||||
@@ -700,7 +700,7 @@ int iscsi_host_set_net_params(struct iface_rec *iface, |
||||
netdev = hinfo.iface.netdev; |
||||
} |
||||
|
||||
- if (net_ifup_netdev(netdev)) |
||||
+ if (!t->template->no_netdev && net_ifup_netdev(netdev)) |
||||
log_warning("Could not brining up netdev %s. Try running " |
||||
"'ifup %s' first if login fails.", netdev, netdev); |
||||
|
||||
diff --git a/usr/transport.c b/usr/transport.c |
||||
index 18b770464608..533ba30a8846 100644 |
||||
--- a/usr/transport.c |
||||
+++ b/usr/transport.c |
||||
@@ -114,6 +114,18 @@ struct iscsi_transport_template ocs = { |
||||
.ep_disconnect = ktransport_ep_disconnect, |
||||
}; |
||||
|
||||
+struct iscsi_transport_template qedi = { |
||||
+ .name = "qedi", |
||||
+ .set_host_ip = SET_HOST_IP_REQ, |
||||
+ .use_boot_info = 1, |
||||
+ .bind_ep_required = 1, |
||||
+ .no_netdev = 1, |
||||
+ .ep_connect = ktransport_ep_connect, |
||||
+ .ep_poll = ktransport_ep_poll, |
||||
+ .ep_disconnect = ktransport_ep_disconnect, |
||||
+ .set_net_config = uip_broadcast_params, |
||||
+}; |
||||
+ |
||||
static struct iscsi_transport_template *iscsi_transport_templates[] = { |
||||
&iscsi_tcp, |
||||
&iscsi_iser, |
||||
@@ -123,6 +135,7 @@ static struct iscsi_transport_template *iscsi_transport_templates[] = { |
||||
&qla4xxx, |
||||
&be2iscsi, |
||||
&ocs, |
||||
+ &qedi, |
||||
NULL |
||||
}; |
||||
|
||||
diff --git a/usr/transport.h b/usr/transport.h |
||||
index 4d3bdbff67f8..b67776b47288 100644 |
||||
--- a/usr/transport.h |
||||
+++ b/usr/transport.h |
||||
@@ -39,6 +39,7 @@ struct iscsi_transport_template { |
||||
uint8_t set_host_ip; |
||||
uint8_t use_boot_info; |
||||
uint8_t bind_ep_required; |
||||
+ uint8_t no_netdev; |
||||
int (*ep_connect) (struct iscsi_conn *conn, int non_blocking); |
||||
int (*ep_poll) (struct iscsi_conn *conn, int timeout_ms); |
||||
void (*ep_disconnect) (struct iscsi_conn *conn); |
||||
-- |
||||
2.9.3 |
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,84 @@
@@ -0,0 +1,84 @@
|
||||
From 13ade0423449530836ccb4c4d94ae36ce5257b56 Mon Sep 17 00:00:00 2001 |
||||
From: Nilesh Javali <nilesh.javali@cavium.com> |
||||
Date: Fri, 11 Nov 2016 08:17:52 +0200 |
||||
Subject: iscsiuio: v0.7.8.3 |
||||
|
||||
Signed-off-by: Manish Rangankar <manish.rangankar@cavium.com> |
||||
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com> |
||||
Signed-off-by: Nilesh Javali <nilesh.javali@cavium.com> |
||||
--- |
||||
iscsiuio/README | 4 ++-- |
||||
iscsiuio/RELEASE.TXT | 20 ++++++++------------ |
||||
iscsiuio/configure.ac | 4 ++-- |
||||
3 files changed, 12 insertions(+), 16 deletions(-) |
||||
|
||||
diff --git a/iscsiuio/README b/iscsiuio/README |
||||
index 9ae14111dd40..ca2da16a7342 100644 |
||||
--- a/iscsiuio/README |
||||
+++ b/iscsiuio/README |
||||
@@ -1,6 +1,6 @@ |
||||
Iscsiuio Userspace Tool |
||||
-Version 0.7.8.2 |
||||
-Dec 10, 2013 |
||||
+Version 0.7.8.3 |
||||
+Sept 28, 2016 |
||||
------------------------------------------------------ |
||||
|
||||
This tool is to be used in conjunction with the QLogic NetXtreme II Linux |
||||
diff --git a/iscsiuio/RELEASE.TXT b/iscsiuio/RELEASE.TXT |
||||
index 44d67f9ceb84..69c5b5f6bd61 100644 |
||||
--- a/iscsiuio/RELEASE.TXT |
||||
+++ b/iscsiuio/RELEASE.TXT |
||||
@@ -1,7 +1,7 @@ |
||||
Release Notes |
||||
QLogic uIP Linux Driver |
||||
- Version 0.7.8.2 |
||||
- 12/10/2013 |
||||
+ Version 0.7.8.3 |
||||
+ 9/28/2016 |
||||
|
||||
QLogic Corporation |
||||
26650 Aliso Viejo Pkwy, |
||||
@@ -11,17 +11,13 @@ |
||||
Copyright (c) 2014, QLogic Corporation |
||||
All rights reserved |
||||
|
||||
-uIP v0.7.10.2 (Feb 12, 2014) |
||||
-======================================================= |
||||
- Fixes |
||||
- ----- |
||||
- 1. Problem: Cont00072504 - ifconfig shows allocation failure after |
||||
- up/down few hours with iSCSI + L2 traffic |
||||
- Cause: A memory leak was discovered in the ongoing pthread creation |
||||
- destruction code during the connection recovery process |
||||
- Change: Fixed the pthread creation code |
||||
- Impact: All |
||||
|
||||
+uIP v0.7.8.3 (Sept 28, 2016) |
||||
+======================================================= |
||||
+ Enhancements |
||||
+ ------------ |
||||
+ 1. Change: Add support for the new qedi transport |
||||
+ Impact: 10/25/40/50GGbE Controller (iSCSI) |
||||
|
||||
uIP v0.7.8.2 (Dec 10, 2013) |
||||
======================================================= |
||||
diff --git a/iscsiuio/configure.ac b/iscsiuio/configure.ac |
||||
index ed1499cdbba1..075d07d04f34 100644 |
||||
--- a/iscsiuio/configure.ac |
||||
+++ b/iscsiuio/configure.ac |
||||
@@ -12,9 +12,9 @@ dnl Benjamin Li (benli@broadcom.com) |
||||
dnl |
||||
|
||||
PACKAGE=iscsiuio |
||||
-VERSION=0.7.8.2 |
||||
+VERSION=0.7.8.3 |
||||
|
||||
-AC_INIT([iscsiuio], [0.7.8.2], [QLogic-Storage-Upstream@qlogic.com]) |
||||
+AC_INIT([iscsiuio], [0.7.8.3], [QLogic-Storage-Upstream@cavium.com]) |
||||
|
||||
AM_INIT_AUTOMAKE |
||||
AC_CONFIG_HEADER(config.h) |
||||
-- |
||||
2.9.3 |
||||
|
@ -0,0 +1,27 @@
@@ -0,0 +1,27 @@
|
||||
From 2235c48bd993ead1d6e3de405b98b524d4bc0b61 Mon Sep 17 00:00:00 2001 |
||||
From: Chris Leech <cleech@redhat.com> |
||||
Date: Tue, 28 Feb 2017 19:34:03 -0800 |
||||
Subject: iscsid: reset head on wrap when buffer empty |
||||
|
||||
Reported-By: David Jeffery <djeffery@redhat.com> |
||||
--- |
||||
usr/log.c | 3 +++ |
||||
1 file changed, 3 insertions(+) |
||||
|
||||
diff --git a/usr/log.c b/usr/log.c |
||||
index 26c61d847793..b730642779bf 100644 |
||||
--- a/usr/log.c |
||||
+++ b/usr/log.c |
||||
@@ -189,6 +189,9 @@ int log_enqueue (int prio, const char * fmt, va_list ap) |
||||
(len + sizeof(struct logmsg)) > (la->end - la->tail)) { |
||||
logdbg(stderr, "enqueue: rewind tail to %p\n", la->tail); |
||||
la->tail = la->start; |
||||
+ |
||||
+ if (la->empty) |
||||
+ la->head = lastmsg = la->tail; |
||||
} |
||||
|
||||
/* not enough space on head : drop msg */ |
||||
-- |
||||
2.9.3 |
||||
|
@ -0,0 +1,485 @@
@@ -0,0 +1,485 @@
|
||||
%define open_iscsi_version 2.0 |
||||
%define open_iscsi_build 874 |
||||
|
||||
Summary: iSCSI daemon and utility programs |
||||
Name: iscsi-initiator-utils |
||||
Version: 6.%{open_iscsi_version}.%{open_iscsi_build} |
||||
Release: 7%{?dist} |
||||
Group: System Environment/Daemons |
||||
License: GPLv2+ |
||||
URL: http://www.open-iscsi.org |
||||
|
||||
Source0: https://github.com/open-iscsi/open-iscsi/archive/%{open_iscsi_version}.%{open_iscsi_build}.tar.gz#/open-iscsi-%{open_iscsi_version}.%{open_iscsi_build}.tar.gz |
||||
Source4: 04-iscsi |
||||
Source5: iscsi-tmpfiles.conf |
||||
|
||||
# upstream patches, post last tagged version |
||||
Patch1: open-iscsi-2.0.874-1-iBFT-origin-is-an-enum-not-a-string.patch |
||||
Patch2: open-iscsi-2.0.874-4-iscsid-treat-SIGTERM-like-iscsiadm-k-0.patch |
||||
Patch3: open-iscsi-2.0.874-5-Make-event_loop_stop-volatile-for-safer-access.patch |
||||
Patch4: open-iscsi-2.0.874-7-iscsid-Changes-to-support-the-new-qedi-transport.patch |
||||
Patch5: open-iscsi-2.0.874-8-iscsiuio-Add-support-for-the-new-qedi-transport.patch |
||||
Patch6: open-iscsi-2.0.874-9-iscsiuio-v0.7.8.3.patch |
||||
Patch7: open-iscsi-2.0.874-7-Allow-disabling-auto-LUN-scans.patch |
||||
Patch8: open-iscsi-2.0.874-23-Fix-manual-LUN-scans-feature.patch |
||||
Patch9: open-iscsi-2.0.874-27-iscsid-Add-qedi-ping-transport-hook.patch |
||||
Patch20: open-iscsi-2.0.874-30-isolate-iscsistart-socket-use.patch |
||||
# not (yet) upstream merged |
||||
Patch140: open-iscsi-2.0.874-iscsid-reset-head-on-wrap-when-buffer-empty.patch |
||||
Patch143: 0143-idmb_rec_write-check-for-tpgt-first.patch |
||||
Patch145: 0145-idbm_rec_write-seperate-old-and-new-style-writes.patch |
||||
Patch146: 0146-idbw_rec_write-pick-tpgt-from-existing-record.patch |
||||
Patch149: 0149-update-systemd-service-files-add-iscsi.service-for-s.patch |
||||
Patch150: 0150-iscsi-boot-related-service-file-updates.patch |
||||
# distro specific modifications |
||||
Patch151: 0151-update-initscripts-and-docs.patch |
||||
Patch152: 0152-use-var-for-config.patch |
||||
Patch153: 0153-use-red-hat-for-name.patch |
||||
Patch154: 0154-add-libiscsi.patch |
||||
Patch156: 0156-remove-the-offload-boot-supported-ifdef.patch |
||||
Patch159: 0159-iscsiuio-systemd-unit-files.patch |
||||
Patch160: 0160-use-systemctl-to-start-iscsid.patch |
||||
Patch161: 0161-resolve-565245-multilib-issues-caused-by-doxygen.patch |
||||
Patch162: 0162-Don-t-check-for-autostart-sessions-if-iscsi-is-not-u.patch |
||||
Patch164: 0164-libiscsi-fix-incorrect-strncpy-use.patch |
||||
Patch166: 0166-start-socket-listeners-on-iscsiadm-command.patch |
||||
Patch167: 0167-Revert-iscsiadm-return-error-when-login-fails.patch |
||||
Patch168: 0168-update-handling-of-boot-sessions.patch |
||||
Patch169: 0169-update-iscsi.service-for-boot-session-recovery.patch |
||||
Patch170: 0170-fix-systemd-unit-wants.patch |
||||
Patch172: 0172-move-cleanup-to-seperate-service.patch |
||||
Patch175: be2iscsi-vlan.patch |
||||
# upstream removed internal open-isns, but not taking that here just yet |
||||
# it requires repackaging isns-utils to provide a debug package |
||||
Patch198: keep-open-isns.patch |
||||
# version string, needs to be updated with each build |
||||
Patch199: 0199-use-Red-Hat-version-string-to-match-RPM-package-vers.patch |
||||
|
||||
BuildRequires: flex bison python-devel doxygen kmod-devel systemd-devel libmount-devel autoconf automake libtool |
||||
# For dir ownership |
||||
Requires: %{name}-iscsiuio >= %{version}-%{release} |
||||
Requires(post): systemd |
||||
Requires(preun): systemd |
||||
Requires(postun): systemd |
||||
|
||||
%global _hardened_build 1 |
||||
%global __provides_exclude_from ^(%{python_sitearch}/.*\\.so)$ |
||||
|
||||
%description |
||||
The iscsi package provides the server daemon for the iSCSI protocol, |
||||
as well as the utility programs used to manage it. iSCSI is a protocol |
||||
for distributed disk access using SCSI commands sent over Internet |
||||
Protocol networks. |
||||
|
||||
%package iscsiuio |
||||
Summary: Userspace configuration daemon required for some iSCSI hardware |
||||
Group: System Environment/Daemons |
||||
License: BSD |
||||
Requires: %{name} = %{version}-%{release} |
||||
|
||||
%description iscsiuio |
||||
The iscsiuio configuration daemon provides network configuration help |
||||
for some iSCSI offload hardware. |
||||
|
||||
%package devel |
||||
Summary: Development files for %{name} |
||||
Group: Development/Libraries |
||||
Requires: %{name} = %{version}-%{release} |
||||
|
||||
%description devel |
||||
The %{name}-devel package contains libraries and header files for |
||||
developing applications that use %{name}. |
||||
|
||||
%prep |
||||
%autosetup -p1 -n open-iscsi-%{open_iscsi_version}.%{open_iscsi_build} |
||||
|
||||
# change exec_prefix, there's no easy way to override |
||||
%{__sed} -i -e 's|^exec_prefix = /$|exec_prefix = %{_exec_prefix}|' Makefile |
||||
|
||||
%build |
||||
|
||||
# configure sub-packages from here |
||||
# letting the top level Makefile do it will lose setting from rpm |
||||
cd iscsiuio |
||||
autoreconf --install |
||||
%{configure} |
||||
cd .. |
||||
|
||||
cd utils/open-isns |
||||
chmod +x ./configure |
||||
%{configure} --with-security=no --with-slp=no |
||||
cd ../.. |
||||
|
||||
%{__make} OPTFLAGS="%{optflags} %{?__global_ldflags} -DUSE_KMOD -lkmod" |
||||
pushd libiscsi |
||||
python setup.py build |
||||
touch -r libiscsi.doxy html/* |
||||
popd |
||||
|
||||
|
||||
%install |
||||
%{__make} DESTDIR=%{?buildroot} install_programs install_doc install_etc |
||||
# upstream makefile doesn't get everything the way we like it |
||||
rm $RPM_BUILD_ROOT%{_sbindir}/iscsi_discovery |
||||
rm $RPM_BUILD_ROOT%{_mandir}/man8/iscsi_discovery.8 |
||||
%{__install} -pm 755 usr/iscsistart $RPM_BUILD_ROOT%{_sbindir} |
||||
%{__install} -pm 644 doc/iscsistart.8 $RPM_BUILD_ROOT%{_mandir}/man8 |
||||
%{__install} -pm 644 doc/iscsi-iname.8 $RPM_BUILD_ROOT%{_mandir}/man8 |
||||
%{__install} -d $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d |
||||
%{__install} -pm 644 iscsiuio/iscsiuiolog $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d |
||||
|
||||
%{__install} -d $RPM_BUILD_ROOT%{_sharedstatedir}/iscsi |
||||
%{__install} -d $RPM_BUILD_ROOT%{_sharedstatedir}/iscsi/nodes |
||||
%{__install} -d $RPM_BUILD_ROOT%{_sharedstatedir}/iscsi/send_targets |
||||
%{__install} -d $RPM_BUILD_ROOT%{_sharedstatedir}/iscsi/static |
||||
%{__install} -d $RPM_BUILD_ROOT%{_sharedstatedir}/iscsi/isns |
||||
%{__install} -d $RPM_BUILD_ROOT%{_sharedstatedir}/iscsi/slp |
||||
%{__install} -d $RPM_BUILD_ROOT%{_sharedstatedir}/iscsi/ifaces |
||||
|
||||
# for %%ghost |
||||
%{__install} -d $RPM_BUILD_ROOT/var/lock/iscsi |
||||
touch $RPM_BUILD_ROOT/var/lock/iscsi/lock |
||||
|
||||
|
||||
%{__install} -d $RPM_BUILD_ROOT%{_unitdir} |
||||
%{__install} -pm 644 etc/systemd/iscsi.service $RPM_BUILD_ROOT%{_unitdir} |
||||
%{__install} -pm 644 etc/systemd/iscsi-shutdown.service $RPM_BUILD_ROOT%{_unitdir} |
||||
%{__install} -pm 644 etc/systemd/iscsid.service $RPM_BUILD_ROOT%{_unitdir} |
||||
%{__install} -pm 644 etc/systemd/iscsid.socket $RPM_BUILD_ROOT%{_unitdir} |
||||
%{__install} -pm 644 etc/systemd/iscsiuio.service $RPM_BUILD_ROOT%{_unitdir} |
||||
%{__install} -pm 644 etc/systemd/iscsiuio.socket $RPM_BUILD_ROOT%{_unitdir} |
||||
|
||||
%{__install} -d $RPM_BUILD_ROOT%{_libexecdir} |
||||
%{__install} -pm 755 etc/systemd/iscsi-mark-root-nodes $RPM_BUILD_ROOT%{_libexecdir} |
||||
|
||||
%{__install} -d $RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/dispatcher.d |
||||
%{__install} -pm 755 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/dispatcher.d |
||||
|
||||
%{__install} -d $RPM_BUILD_ROOT%{_tmpfilesdir} |
||||
%{__install} -pm 644 %{SOURCE5} $RPM_BUILD_ROOT%{_tmpfilesdir}/iscsi.conf |
||||
|
||||
%{__install} -d $RPM_BUILD_ROOT%{_libdir} |
||||
%{__install} -pm 755 libiscsi/libiscsi.so.0 $RPM_BUILD_ROOT%{_libdir} |
||||
%{__ln_s} libiscsi.so.0 $RPM_BUILD_ROOT%{_libdir}/libiscsi.so |
||||
%{__install} -d $RPM_BUILD_ROOT%{_includedir} |
||||
%{__install} -pm 644 libiscsi/libiscsi.h $RPM_BUILD_ROOT%{_includedir} |
||||
|
||||
%{__install} -d $RPM_BUILD_ROOT%{python_sitearch} |
||||
%{__install} -pm 755 libiscsi/build/lib.linux-*/libiscsimodule.so \ |
||||
$RPM_BUILD_ROOT%{python_sitearch} |
||||
|
||||
|
||||
%post |
||||
/sbin/ldconfig |
||||
|
||||
%systemd_post iscsi.service iscsi-shutdown.service iscsid.service iscsid.socket |
||||
|
||||
if [ $1 -eq 1 ]; then |
||||
if [ ! -f %{_sysconfdir}/iscsi/initiatorname.iscsi ]; then |
||||
echo "InitiatorName=`/usr/sbin/iscsi-iname`" > %{_sysconfdir}/iscsi/initiatorname.iscsi |
||||
fi |
||||
# enable socket activation and persistant session startup by default |
||||
/bin/systemctl enable iscsi.service >/dev/null 2>&1 || : |
||||
/bin/systemctl enable iscsid.socket >/dev/null 2>&1 || : |
||||
/bin/systemctl start iscsid.socket >/dev/null 2>&1 || : |
||||
fi |
||||
|
||||
%post iscsiuio |
||||
%systemd_post iscsiuio.service iscsiuio.socket |
||||
|
||||
if [ $1 -eq 1 ]; then |
||||
/bin/systemctl enable iscsiuio.socket >/dev/null 2>&1 || : |
||||
/bin/systemctl start iscsiuio.socket >/dev/null 2>&1 || : |
||||
fi |
||||
|
||||
%preun |
||||
%systemd_preun iscsi.service iscsi-shutdown.service iscsid.service iscsiuio.service iscsid.socket iscsiuio.socket |
||||
|
||||
%preun iscsiuio |
||||
%systemd_preun iscsiuio.service iscsiuio.socket |
||||
|
||||
%postun |
||||
/sbin/ldconfig |
||||
%systemd_postun |
||||
|
||||
%postun iscsiuio |
||||
%systemd_postun |
||||
|
||||
%triggerun -- iscsi-initiator-utils < 6.2.0.873-22 |
||||
# prior to 6.2.0.873-22 iscsi.service was missing a Wants=remote-fs-pre.target |
||||
# this forces remote-fs-pre.target active if needed for a clean shutdown/reboot |
||||
# after upgrading this package |
||||
if [ $1 -gt 0 ]; then |
||||
/usr/bin/systemctl -q is-active iscsi.service |
||||
if [ $? -eq 0 ]; then |
||||
/usr/bin/systemctl -q is-active remote-fs-pre.target |
||||
if [ $? -ne 0 ]; then |
||||
SRC=`/usr/bin/systemctl show --property FragmentPath remote-fs-pre.target | cut -d= -f2` |
||||
DST=/run/systemd/system/remote-fs-pre.target |
||||
if [ $SRC != $DST ]; then |
||||
cp $SRC $DST |
||||
fi |
||||
sed -i 's/RefuseManualStart=yes/RefuseManualStart=no/' $DST |
||||
/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || : |
||||
/usr/bin/systemctl start remote-fs-pre.target >/dev/null 2>&1 || : |
||||
fi |
||||
fi |
||||
fi |
||||
# added in 6.2.0.873-26 |
||||
if [ $1 -gt 0 ]; then |
||||
systemctl start iscsi-shutdown.service >/dev/null 2>&1 || : |
||||
fi |
||||
|
||||
%files |
||||
%doc README |
||||
%dir %{_sharedstatedir}/iscsi |
||||
%dir %{_sharedstatedir}/iscsi/nodes |
||||
%dir %{_sharedstatedir}/iscsi/isns |
||||
%dir %{_sharedstatedir}/iscsi/static |
||||
%dir %{_sharedstatedir}/iscsi/slp |
||||
%dir %{_sharedstatedir}/iscsi/ifaces |
||||
%dir %{_sharedstatedir}/iscsi/send_targets |
||||
%ghost %{_var}/lock/iscsi |
||||
%ghost %{_var}/lock/iscsi/lock |
||||
%{_unitdir}/iscsi.service |
||||
%{_unitdir}/iscsi-shutdown.service |
||||
%{_unitdir}/iscsid.service |
||||
%{_unitdir}/iscsid.socket |
||||
%{_libexecdir}/iscsi-mark-root-nodes |
||||
%{_sysconfdir}/NetworkManager/dispatcher.d/04-iscsi |
||||
%{_tmpfilesdir}/iscsi.conf |
||||
%dir %{_sysconfdir}/iscsi |
||||
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/iscsi/iscsid.conf |
||||
%{_sbindir}/iscsi-iname |
||||
%{_sbindir}/iscsiadm |
||||
%{_sbindir}/iscsid |
||||
%{_sbindir}/iscsistart |
||||
%{_libdir}/libiscsi.so.0 |
||||
%{python_sitearch}/libiscsimodule.so |
||||
%{_mandir}/man8/iscsi-iname.8.gz |
||||
%{_mandir}/man8/iscsiadm.8.gz |
||||
%{_mandir}/man8/iscsid.8.gz |
||||
%{_mandir}/man8/iscsistart.8.gz |
||||
|
||||
%files iscsiuio |
||||
%{_sbindir}/iscsiuio |
||||
%{_unitdir}/iscsiuio.service |
||||
%{_unitdir}/iscsiuio.socket |
||||
%config(noreplace) %{_sysconfdir}/logrotate.d/iscsiuiolog |
||||
%{_mandir}/man8/iscsiuio.8.gz |
||||
|
||||
%files devel |
||||
%doc libiscsi/html |
||||
%{_libdir}/libiscsi.so |
||||
%{_includedir}/libiscsi.h |
||||
|
||||
%changelog |
||||
* Thu Nov 30 2017 Chris Leech <cleech@redhat.com> - 6.2.0.874-7 |
||||
- 1328694 keep vlan settings in sync for ipv4/ipv6 iface records with be2iscsi |
||||
|
||||
* Wed Nov 01 2017 Chris Leech <cleech@redhat.com> - 6.2.0.874-6 |
||||
- 1507945 force start iscsiuio for boot session recovery with qedi |
||||
- 1457359 start systemd socket listeners, otherwise if iscsid is started |
||||
directly iscsiuio doesn't activate as expected |
||||
|
||||
* Tue Aug 15 2017 Chris Leech <cleech@redhat.com> - 6.2.0.874-5 |
||||
- 1431622 fix default in iscsi-iname manpage to match Red Hat customization |
||||
|
||||
* Tue Jun 27 2017 Chris Leech <cleech@redhat.com> - 6.2.0.874-4 |
||||
- 1450756 isolate iscsistart sockets |
||||
|
||||
* Fri Apr 28 2017 Chris Leech <cleech@redhat.com> - 6.2.0.874-3 |
||||
- 1445686 add missing ping hook for the qedi transport driver |
||||
|
||||
* Tue Apr 11 2017 Chris Leech <cleech@redhat.com> - 6.2.0.874-2 |
||||
- 1422941 allow disabling of auto scanning sessions, requested for OpenStack |
||||
|
||||
* Tue Feb 28 2017 Chris Leech <cleech@redhat.com> - 6.2.0.874-1 |
||||
- 1384090 upstream 2.0.874+ with qedi support |
||||
- 1414819 iscsid reporting blank emerg messages |
||||
|
||||
* Thu Aug 18 2016 Chris Leech <cleech@redhat.com> - 6.2.0.873-35 |
||||
- 1362590 Revert iscsiuio pthread changes that result in a race condition on shutdown |
||||
|
||||
* Tue Jun 14 2016 Chris Leech <cleech@redhat.com> - 6.2.0.873-34 |
||||
- 1322000 ensure TCP abort on session failure to prevent data corruption with link flap |
||||
- 1294964, 1265073, 1213569 iscsiuio update, fix small ARP table issue |
||||
- 1309488 remove broken sysfs cache code to speed up login of many sessions |
||||
- 1330348 sync with upstream Open-iSCSI for minor fixes |
||||
|
||||
* Tue Apr 26 2016 Chris Leech <cleech@redhat.com> - 6.2.0.873-33 |
||||
- 1275139 iscsiuio support for multi-function mode NetXtreme2 HBAs |
||||
|
||||
* Fri Jul 24 2015 Chris Leech <cleech@redhat.com> - 6.2.0.873-32 |
||||
- 1235684 apply safe_logout setting to flashnode sessions as well |
||||
but only when logging out by session id, not by flashnode index |
||||
|
||||
* Tue Jul 21 2015 Chris Leech <cleech@redhat.com> - 6.2.0.873-31 |
||||
- 1235684 fix safe logout DM name canonicalization, use libmount cache |
||||
|
||||
* Mon Jul 06 2015 Chris Leech <cleech@redhat.com> - 6.2.0.873-30 |
||||
- 1235684 add iscsid safe logout option |
||||
|
||||
* Fri Jan 30 2015 Chris Leech <cleech@redhat.com> - 6.2.0.873-29 |
||||
- 1166713 1187792 add missing ExecStart, only newer systemd lets that be optional for oneshot services |
||||
|
||||
* Thu Jan 15 2015 Chris Leech <cleech@redhat.com> - 6.2.0.873-28 |
||||
- 1180100 scriptlets were never split out properly for the iscsiuio subpackage |
||||
|
||||
* Thu Jan 15 2015 Chris Leech <cleech@redhat.com> - 6.2.0.873-27 |
||||
- 1168556 fix regression in network interface binding |
||||
|
||||
* Mon Jan 12 2015 Chris Leech <cleech@redhat.com> - 6.2.0.873-26 |
||||
- 1166713 created iscsi-shutdown.service to ensure that session cleanup happens |
||||
|
||||
* Thu Dec 11 2014 Andy Grover <agrover@redhat.com> - 6.2.0.873-25 |
||||
- Add --with-slp=no for #1088020 |
||||
|
||||
* Tue Nov 18 2014 Chris Leech <cleech@redhat.com> - 6.2.0.873-24 |
||||
- 1040343 segfault from unexpected netlink event during discovery |
||||
- inhibit strict aliasing optimizations in iscsiuio, rpmdiff error |
||||
|
||||
* Tue Oct 21 2014 Chris Leech <cleech@redhat.com> - 6.2.0.873-23 |
||||
- make sure to pass --with-security=no to isns configure (#1088020) |
||||
|
||||
* Wed Sep 24 2014 Chris Leech <cleech@redhat.com> - 6.2.0.873-22 |
||||
- 1081798 retry login on host not found error |
||||
- 1111925 ignore iscsiadm return in iscsi.service |
||||
- 1126524 make sure systemd order against remote mounts is correct |
||||
- 963039 add discovery as a valid mode in iscsiadm.8 |
||||
- sync with upstream |
||||
|
||||
* Tue Mar 18 2014 Chris Leech <cleech@redhat.com> - 6.2.0.873-21 |
||||
- 1069825 |
||||
- boot session handling improvements |
||||
- Fix iscsi-mark-root for changed iscsiadm output |
||||
- Make sure iscsiuio is running for boot session recovery when using the |
||||
bnx2i transport by forcing iscsiuio.service start |
||||
- Make NM dispatch triggered re-check for autostart sessions async |
||||
- Accept exit code 21, no records, from iscsiadm as success in |
||||
iscsi.service |
||||
|
||||
* Tue Feb 25 2014 Chris Leech <cleech@redhat.com> - 6.2.0.873-20 |
||||
- 1049710 host0 being treated as an invalid in the host stats command |
||||
- 1015563 revert change to return code when calling login_portal for sessions |
||||
that already exist, as it impacts users scripting around iscsiadm |
||||
|
||||
* Mon Feb 17 2014 Chris Leech <cleech@redhat.com> - 6.2.0.873-19 |
||||
- 1007388 fixes for iscsiadm to support qla4xxx |
||||
- refresh boot session info patches to final version from upstream, |
||||
fixes context issues with later patches |
||||
- 1006156, 1006161 Add/Update entries in chap table through Open-iSCSI |
||||
- 948134 extend support to set additional parameters for network configuration |
||||
- 1049710 update open-iscsi to support host statistics |
||||
- 1043019 iscsiuio fix for arp cache flush issue |
||||
- 1059332 Fix broken discovery sessions over iser |
||||
- 1017393 split out iscsiuio into a seperate sub-package |
||||
|
||||
* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 6.2.0.873-18 |
||||
- Mass rebuild 2014-01-24 |
||||
|
||||
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 6.2.0.873-17 |
||||
- Mass rebuild 2013-12-27 |
||||
|
||||
* Mon Nov 25 2013 Chris Leech <cleech@redhat.com> - 6.2.0.873-16 |
||||
- fix iscsiuio socket activation |
||||
- have systemd start socket units on iscsiadm use, if not already listening |
||||
|
||||
* Sun Sep 15 2013 Chris Leech <cleech@redhat.com> - 6.2.0.873-15 |
||||
- move /sbin to /usr/sbin |
||||
- use rpm macros in install rules |
||||
|
||||
* Fri Sep 13 2013 Chris Leech <cleech@redhat.com> - 6.2.0.873-14 |
||||
- fix iscsiuio hardened build and other compiler flags |
||||
|
||||
* Fri Aug 23 2013 Andy Grover <agrover@redhat.com> - 6.2.0.873-13 |
||||
- Fix patch 0041 to check session != NULL before calling iscsi_sysfs_read_boot() |
||||
|
||||
* Tue Aug 20 2013 Chris Leech <cleech@redhat.com> - 6.2.0.873-12 |
||||
- fix regression in last build, database records can't be accessed |
||||
|
||||
* Mon Aug 19 2013 Chris Leech <cleech@redhat.com> - 6.2.0.873-11 |
||||
- iscsi boot related fixes |
||||
make sure iscsid gets started if there are any boot sessions running |
||||
add reload target to fix double session problem when restarting from NM |
||||
don't rely on session list passed from initrd, never got fully implemented |
||||
remove patches related to running iscsid from initrd, possible to revisit later |
||||
|
||||
* Sun Aug 18 2013 Chris Leech <cleech@redhat.com> - 6.2.0.873-10 |
||||
- sync with upstream git, minor context fixes after rebase of out-of-tree patches |
||||
- iscsiuio is merged upstream, remove old source archive and patches |
||||
- spec cleanups to fix rpmlint issues |
||||
|
||||
* Sun Aug 4 2013 Peter Robinson <pbrobinson@fedoraproject.org> 6.2.0.873-9 |
||||
- Fix FTBFS, cleanup spec |
||||
|
||||
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.2.0.873-8 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild |
||||
|
||||
* Tue Jun 11 2013 Chris Leech <cleech@redhat.com> - 6.2.0.873-7 |
||||
- Use the systemd tmpfiles service to recreate lockfiles in /var/lock |
||||
- 955167 build as a position independent executable |
||||
- 894576 fix order of setuid/setgid and drop additional groups |
||||
|
||||
* Tue May 28 2013 Chris Leech <cleech@redhat.com> - 6.2.0.873-6 |
||||
- Don't have iscsiadm scan for autostart record if node db is empty (bug #951951) |
||||
|
||||
* Tue Apr 30 2013 Orion Poplawski <orion@cora.nwra.com> - 6.2.0.873-5 |
||||
- Fix typo in NM dispatcher script (bug #917058) |
||||
|
||||
* Thu Feb 21 2013 Chris Leech <cleech@redhat.com> - 6.2.0.873-4 |
||||
- build with libkmod support, instead of calling out to modprobe |
||||
- enable socket activation by default |
||||
|
||||
* Thu Jan 24 2013 Kalev Lember <kalevlember@gmail.com> - 6.2.0.873-3 |
||||
- Fix the postun script to not use ldconfig as the interpreter |
||||
|
||||
* Wed Jan 23 2013 Chris Leech <cleech@redhat.com> - 6.2.0.873-2 |
||||
- package iscsi_mark_root_nodes script, it's being referenced by the unit files |
||||
|
||||
* Tue Jan 22 2013 Chris Leech <cleech@redhat.com> - 6.2.0.873-1 |
||||
- rebase to new upstream code |
||||
- systemd conversion |
||||
- 565245 Fix multilib issues caused by timestamp in doxygen footers |
||||
|
||||
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.2.0.872-19 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild |
||||
|
||||
* Tue Feb 14 2012 Mike Christie <mchristi@redhat.com> 6.2.0.872.18 |
||||
- 789683 Fix boot slow down when the iscsi service is started |
||||
(regression added in 6.2.0.872.16 when the nm wait was added). |
||||
|
||||
* Mon Feb 6 2012 Mike Christie <mchristi@redhat.com> 6.2.0.872.17 |
||||
- 786174 Change iscsid/iscsi service startup, so it always starts |
||||
when called. |
||||
|
||||
* Sat Feb 4 2012 Mike Christie <mchristi@redhat.com> 6.2.0.872.16 |
||||
- 747479 Fix iscsidevs handling of network requirement |
||||
|
||||
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.2.0.872-15 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild |
||||
|
||||
* Wed Nov 30 2011 Mike Christie <mcrhsit@redhat.com> 6.2.0.872.14 |
||||
- Fix version string to reflect fedora and not rhel. |
||||
|
||||
* Tue Oct 18 2011 Mike Christie <mcrhsit@redhat.com> 6.2.0.872.13 |
||||
- Update iscsi tools. |
||||
|
||||
* Sat Apr 30 2011 Hans de Goede <hdegoede@redhat.com> - 6.2.0.872-12 |
||||
- Change iscsi init scripts to check for networking being actually up, rather |
||||
then for NetworkManager being started (#692230) |
||||
|
||||
* Tue Apr 26 2011 Hans de Goede <hdegoede@redhat.com> - 6.2.0.872-11 |
||||
- Fix iscsid autostarting when upgrading from an older version |
||||
(add iscsid.startup key to iscsid.conf on upgrade) |
||||
- Fix printing of [ OK ] when successfully stopping iscsid |
||||
- systemd related fixes: |
||||
- Add Should-Start/Stop tgtd to iscsi init script to fix (re)boot from |
||||
hanging when using locally hosted targets |
||||
- %%ghost /var/lock/iscsi and contents (#656605) |
||||
|
||||
* Mon Apr 25 2011 Mike Christie <mchristi@redhat.com> 6.2.0.872-10 |
||||
- Fix iscsi init scripts check for networking being up (#692230) |
||||
|
||||
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.2.0.872-9 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild |
Loading…
Reference in new issue