sync with upstream, sysfs handling improvements
This commit is contained in:
parent
870cad93ef
commit
949adddc31
58
0001-Build-system-sort-object-file-lists.patch
Normal file
58
0001-Build-system-sort-object-file-lists.patch
Normal file
@ -0,0 +1,58 @@
|
||||
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.1.4
|
||||
|
@ -1,25 +0,0 @@
|
||||
From ec84dfefd6bc98ef1d35f42b0fbc33d6ff90f130 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Leech <cleech@redhat.com>
|
||||
Date: Mon, 21 Jan 2013 15:43:36 -0800
|
||||
Subject: [PATCH] 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 a090522..fc99846 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-873"
|
||||
+#define ISCSI_VERSION_STR "6.2.0.873-26"
|
||||
#define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version"
|
||||
|
||||
#endif
|
||||
--
|
||||
2.1.0
|
||||
|
@ -1,12 +1,12 @@
|
||||
%global open_iscsi_version 2.0
|
||||
%global open_iscsi_build 873
|
||||
%global commit0 4c9d6f9908bc55e4514b00c178ae72bb0d8fc96b
|
||||
%global commit0 4c1f2d90ef1c73e33d9f1e4ae9c206ffe015a8f9
|
||||
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
|
||||
|
||||
Summary: iSCSI daemon and utility programs
|
||||
Name: iscsi-initiator-utils
|
||||
Version: 6.%{open_iscsi_version}.%{open_iscsi_build}
|
||||
Release: 32.git%{shortcommit0}%{?dist}
|
||||
Release: 33.git%{shortcommit0}%{?dist}
|
||||
Group: System Environment/Daemons
|
||||
License: GPLv2+
|
||||
URL: http://www.open-iscsi.org
|
||||
@ -37,6 +37,8 @@ Patch20:open-iscsi-v2.0.873-4c9d6f9-20-Add-macros-to-release-GIL-lock.patch
|
||||
Patch21:open-iscsi-v2.0.873-4c9d6f9-21-libiscsi-introduce-sessions-API.patch
|
||||
# ugly version string patch, should change with every rebuild
|
||||
Patch22:open-iscsi-v2.0.873-4c9d6f9-22-use-Red-Hat-version-string-to-match-RPM-package-vers.patch
|
||||
Patch23: 0001-Build-system-sort-object-file-lists.patch
|
||||
Patch24: open-iscsi-2.0.873-157-remove-sysfs-attr_list.patch
|
||||
|
||||
BuildRequires: flex bison python2-devel python3-devel python-setuptools doxygen kmod-devel systemd-units
|
||||
BuildRequires: autoconf automake libtool libmount-devel openssl-devel
|
||||
@ -278,6 +280,10 @@ fi
|
||||
%{python3_sitearch}/*
|
||||
|
||||
%changelog
|
||||
* Fri Feb 19 2016 Chris Leech <cleech@redhat.com> - 6.2.0.873-33.git4c1f2d9
|
||||
- sync with upstream
|
||||
- sysfs handling changes to speed up operations over large number of sessions
|
||||
|
||||
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 6.2.0.873-32.git4c9d6f9
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
||||
|
||||
|
214
open-iscsi-2.0.873-157-remove-sysfs-attr_list.patch
Normal file
214
open-iscsi-2.0.873-157-remove-sysfs-attr_list.patch
Normal file
@ -0,0 +1,214 @@
|
||||
From 4ff8602c62ed908a7b7d5f51e863ed0ab4de2659 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Leech <cleech@redhat.com>
|
||||
Date: Tue, 16 Feb 2016 16:45:26 -0800
|
||||
Subject: [PATCH] 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.
|
||||
---
|
||||
usr/host.c | 1 +
|
||||
usr/session_info.c | 1 +
|
||||
usr/sysfs.c | 62 ++++++++++++------------------------------------------
|
||||
3 files changed, 16 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..efd4f74 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;
|
||||
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,8 @@ 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;
|
||||
+ return strdup(value);
|
||||
}
|
||||
|
||||
int sysfs_lookup_devpath_by_subsys_id(char *devpath_full, size_t len, const char *subsystem, const char *id)
|
||||
@@ -567,8 +523,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 +543,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 +559,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 +579,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 +592,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 +611,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 +626,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.0
|
||||
|
@ -16,7 +16,7 @@ index a090522..6894655 100644
|
||||
* some other maintainer could merge a patch without going through us
|
||||
*/
|
||||
-#define ISCSI_VERSION_STR "2.0-873"
|
||||
+#define ISCSI_VERSION_STR "6.2.0.873-29"
|
||||
+#define ISCSI_VERSION_STR "6.2.0.873-33"
|
||||
#define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version"
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user