Blame SOURCES/0001-rec-update-disable-the-idbm_lock-in-read-write-when-.patch

3d2430
From c64a92e32187d24dda44d983809f36e20d9cb92f Mon Sep 17 00:00:00 2001
3d2430
From: Xiubo Li <xiubli@redhat.com>
3d2430
Date: Tue, 18 Jun 2019 10:12:31 +0800
3d2430
Subject: [PATCH 1/1] rec update: disable the idbm_lock in read/write when
3d2430
 updating the rec
3d2430
3d2430
The iscsiadm is getting a file lock while writing out records, and
3d2430
updates are a read-modify-write operation and currently only the
3d2430
write is locked.
3d2430
3d2430
So the parallel requests are reading in the pre-update record and
3d2430
then overwriting each other with the writes.
3d2430
3d2430
Fixing RHBZ#1624670
3d2430
3d2430
Signed-off-by: Xiubo Li <xiubli@redhat.com>
3d2430
---
3d2430
 usr/idbm.c     | 132 +++++++++++++++++++++++++++++++------------------
3d2430
 usr/idbm.h     |  17 ++++---
3d2430
 usr/iface.c    |   2 +-
3d2430
 usr/iscsiadm.c |  18 +++----
3d2430
 usr/iscsid.c   |   2 +-
3d2430
 5 files changed, 105 insertions(+), 66 deletions(-)
3d2430
3d2430
diff --git a/usr/idbm.c b/usr/idbm.c
3d2430
index c238cc7..ca2557f 100644
3d2430
--- a/usr/idbm.c
3d2430
+++ b/usr/idbm.c
3d2430
@@ -1401,7 +1401,12 @@ static FILE *idbm_open_rec_r(char *portal, char *config)
3d2430
 	return fopen(portal, "r");
3d2430
 }
3d2430
 
3d2430
-static int __idbm_rec_read(node_rec_t *out_rec, char *conf)
3d2430
+/*
3d2430
+ * When the disable_lock param is true, the idbm_lock/idbm_unlock needs
3d2430
+ * to be holt by the caller, this will avoid overwriting each other in
3d2430
+ * case of updating(read-modify-write) the recs in parallel.
3d2430
+ */
3d2430
+static int __idbm_rec_read(node_rec_t *out_rec, char *conf, bool disable_lock)
3d2430
 {
3d2430
 	recinfo_t *info;
3d2430
 	FILE *f;
3d2430
@@ -1411,9 +1416,11 @@ static int __idbm_rec_read(node_rec_t *out_rec, char *conf)
3d2430
 	if (!info)
3d2430
 		return ISCSI_ERR_NOMEM;
3d2430
 
3d2430
-	rc = idbm_lock();
3d2430
-	if (rc)
3d2430
-		goto free_info;
3d2430
+	if (!disable_lock) {
3d2430
+		rc = idbm_lock();
3d2430
+		if (rc)
3d2430
+			goto free_info;
3d2430
+	}
3d2430
 
3d2430
 	f = fopen(conf, "r");
3d2430
 	if (!f) {
3d2430
@@ -1430,15 +1437,21 @@ static int __idbm_rec_read(node_rec_t *out_rec, char *conf)
3d2430
 	fclose(f);
3d2430
 
3d2430
 unlock:
3d2430
-	idbm_unlock();
3d2430
+	if (!disable_lock)
3d2430
+		idbm_unlock();
3d2430
 free_info:
3d2430
 	free(info);
3d2430
 	return rc;
3d2430
 }
3d2430
 
3d2430
+/*
3d2430
+ * When the disable_lock param is true, the idbm_lock/idbm_unlock needs
3d2430
+ * to be holt by the caller, this will avoid overwriting each other in
3d2430
+ * case of updating(read-modify-write) the recs in parallel.
3d2430
+ */
3d2430
 int
3d2430
 idbm_rec_read(node_rec_t *out_rec, char *targetname, int tpgt,
3d2430
-	      char *ip, int port, struct iface_rec *iface)
3d2430
+	      char *ip, int port, struct iface_rec *iface, bool disable_lock)
3d2430
 {
3d2430
 	struct stat statb;
3d2430
 	char *portal;
3d2430
@@ -1470,7 +1483,7 @@ idbm_rec_read(node_rec_t *out_rec, char *targetname, int tpgt,
3d2430
 	}
3d2430
 
3d2430
 read:
3d2430
-	rc = __idbm_rec_read(out_rec, portal);
3d2430
+	rc = __idbm_rec_read(out_rec, portal, disable_lock);
3d2430
 free_portal:
3d2430
 	free(portal);
3d2430
 	return rc;
3d2430
@@ -1526,7 +1539,7 @@ static int idbm_print_discovered(discovery_rec_t *drec, int info_level)
3d2430
 	int num_found = 0;
3d2430
 
3d2430
 	if (info_level < 1)
3d2430
-		idbm_for_each_rec(&num_found, drec, print_discovered_flat);
3d2430
+		idbm_for_each_rec(&num_found, drec, print_discovered_flat, false);
3d2430
 	else {
3d2430
 		struct discovered_tree_info tree_info;
3d2430
 		struct node_rec last_rec;
3d2430
@@ -1536,7 +1549,7 @@ static int idbm_print_discovered(discovery_rec_t *drec, int info_level)
3d2430
 		tree_info.drec = drec;
3d2430
 		tree_info.last_rec = &last_rec;
3d2430
 
3d2430
-		idbm_for_each_rec(&num_found, &tree_info,							  print_discovered_tree);
3d2430
+		idbm_for_each_rec(&num_found, &tree_info, print_discovered_tree, false);
3d2430
 	}
3d2430
 	return num_found;
3d2430
 }
3d2430
@@ -1708,9 +1721,9 @@ int idbm_print_all_discovery(int info_level)
3d2430
  * fn should return -1 if it skipped the rec, an ISCSI_ERR error code if
3d2430
  * the operation failed or 0 if fn was run successfully.
3d2430
  */
3d2430
-static int idbm_for_each_iface(int *found, void *data,
3d2430
-				idbm_iface_op_fn *fn,
3d2430
-				char *targetname, int tpgt, char *ip, int port)
3d2430
+static int idbm_for_each_iface(int *found, void *data, idbm_iface_op_fn *fn,
3d2430
+			       char *targetname, int tpgt, char *ip, int port,
3d2430
+			       bool ruw_lock)
3d2430
 {
3d2430
 	DIR *iface_dirfd;
3d2430
 	struct dirent *iface_dent;
3d2430
@@ -1735,7 +1748,7 @@ static int idbm_for_each_iface(int *found, void *data,
3d2430
 		goto free_portal;
3d2430
 	}
3d2430
 
3d2430
-	rc = __idbm_rec_read(&rec, portal);
3d2430
+	rc = __idbm_rec_read(&rec, portal, ruw_lock);
3d2430
 	if (rc)
3d2430
 		goto free_portal;
3d2430
 
3d2430
@@ -1768,7 +1781,7 @@ read_iface:
3d2430
 		memset(portal, 0, PATH_MAX);
3d2430
 		snprintf(portal, PATH_MAX, "%s/%s/%s,%d,%d/%s", NODE_CONFIG_DIR,
3d2430
 			 targetname, ip, port, tpgt, iface_dent->d_name);
3d2430
-		if (__idbm_rec_read(&rec, portal))
3d2430
+		if (__idbm_rec_read(&rec, portal, ruw_lock))
3d2430
 			continue;
3d2430
 
3d2430
 		curr_rc = fn(data, &rec);
3d2430
@@ -1790,7 +1803,7 @@ free_portal:
3d2430
  * The portal could be a file or dir with interfaces
3d2430
  */
3d2430
 int idbm_for_each_portal(int *found, void *data, idbm_portal_op_fn *fn,
3d2430
-			 char *targetname)
3d2430
+			 char *targetname, bool ruw_lock)
3d2430
 {
3d2430
 	DIR *portal_dirfd;
3d2430
 	struct dirent *portal_dent;
3d2430
@@ -1827,7 +1840,8 @@ int idbm_for_each_portal(int *found, void *data, idbm_portal_op_fn *fn,
3d2430
 
3d2430
 		curr_rc = fn(found, data, targetname,
3d2430
 			tmp_tpgt ? atoi(tmp_tpgt) : -1,
3d2430
-			portal_dent->d_name, atoi(tmp_port));
3d2430
+			portal_dent->d_name, atoi(tmp_port),
3d2430
+			ruw_lock);
3d2430
 		/* less than zero means it was not a match */
3d2430
 		if (curr_rc > 0 && !rc)
3d2430
 			rc = curr_rc;
3d2430
@@ -1838,7 +1852,7 @@ done:
3d2430
 	return rc;
3d2430
 }
3d2430
 
3d2430
-int idbm_for_each_node(int *found, void *data, idbm_node_op_fn *fn)
3d2430
+int idbm_for_each_node(int *found, void *data, idbm_node_op_fn *fn, bool ruw_lock)
3d2430
 {
3d2430
 	DIR *node_dirfd;
3d2430
 	struct dirent *node_dent;
3d2430
@@ -1859,7 +1873,7 @@ int idbm_for_each_node(int *found, void *data, idbm_node_op_fn *fn)
3d2430
 			continue;
3d2430
 
3d2430
 		log_debug(5, "searching %s", node_dent->d_name);
3d2430
-		curr_rc = fn(found, data, node_dent->d_name);
3d2430
+		curr_rc = fn(found, data, node_dent->d_name, ruw_lock);
3d2430
 		/* less than zero means it was not a match */
3d2430
 		if (curr_rc > 0 && !rc)
3d2430
 			rc = curr_rc;
3d2430
@@ -1877,18 +1891,30 @@ static int iface_fn(void *data, node_rec_t *rec)
3d2430
 }
3d2430
 
3d2430
 static int portal_fn(int *found, void *data, char *targetname,
3d2430
-		     int tpgt, char *ip, int port)
3d2430
+		     int tpgt, char *ip, int port, bool ruw_lock)
3d2430
 {
3d2430
-	return idbm_for_each_iface(found, data, iface_fn, targetname,
3d2430
-				   tpgt, ip, port);
3d2430
+	int rc;
3d2430
+
3d2430
+	if (ruw_lock) {
3d2430
+		rc = idbm_lock();
3d2430
+		if (rc)
3d2430
+			return rc;
3d2430
+	}
3d2430
+
3d2430
+	rc = idbm_for_each_iface(found, data, iface_fn, targetname,
3d2430
+			         tpgt, ip, port, ruw_lock);
3d2430
+	if (ruw_lock)
3d2430
+		idbm_unlock();
3d2430
+
3d2430
+	return rc;
3d2430
 }
3d2430
 
3d2430
-static int node_fn(int *found, void *data, char *targetname)
3d2430
+static int node_fn(int *found, void *data, char *targetname, bool ruw_lock)
3d2430
 {
3d2430
-	return idbm_for_each_portal(found, data, portal_fn, targetname);
3d2430
+	return idbm_for_each_portal(found, data, portal_fn, targetname, ruw_lock);
3d2430
 }
3d2430
 
3d2430
-int idbm_for_each_rec(int *found, void *data, idbm_iface_op_fn *fn)
3d2430
+int idbm_for_each_rec(int *found, void *data, idbm_iface_op_fn *fn, bool ruw_lock)
3d2430
 {
3d2430
 	struct rec_op_data op_data;
3d2430
 
3d2430
@@ -1896,7 +1922,7 @@ int idbm_for_each_rec(int *found, void *data, idbm_iface_op_fn *fn)
3d2430
 	op_data.data = data;
3d2430
 	op_data.fn = fn;
3d2430
 
3d2430
-	return idbm_for_each_node(found, &op_data, node_fn);
3d2430
+	return idbm_for_each_node(found, &op_data, node_fn, ruw_lock);
3d2430
 }
3d2430
 
3d2430
 static struct {
3d2430
@@ -2141,7 +2167,12 @@ free_portal:
3d2430
 	return rc;
3d2430
 }
3d2430
 
3d2430
-static int idbm_rec_write(node_rec_t *rec)
3d2430
+/*
3d2430
+ * When the disable_lock param is true, the idbm_lock/idbm_unlock needs
3d2430
+ * to be holt by the caller, this will avoid overwriting each other in
3d2430
+ * case of updating(read-modify-write) the recs in parallel.
3d2430
+ */
3d2430
+static int idbm_rec_write(node_rec_t *rec, bool disable_lock)
3d2430
 {
3d2430
 	char *portal;
3d2430
 	int rc = 0;
3d2430
@@ -2172,9 +2203,11 @@ static int idbm_rec_write(node_rec_t *rec)
3d2430
 		}
3d2430
 	}
3d2430
 
3d2430
-	rc = idbm_lock();
3d2430
-	if (rc)
3d2430
-		goto free_portal;
3d2430
+	if (!disable_lock) {
3d2430
+		rc = idbm_lock();
3d2430
+		if (rc)
3d2430
+			goto free_portal;
3d2430
+	}
3d2430
 
3d2430
 	if (rec->tpgt == PORTAL_GROUP_TAG_UNKNOWN)
3d2430
 		/* old style portal as config */
3d2430
@@ -2182,7 +2215,8 @@ static int idbm_rec_write(node_rec_t *rec)
3d2430
 	else
3d2430
 		rc = idbm_rec_write_new(rec);
3d2430
 
3d2430
-	idbm_unlock();
3d2430
+	if (!disable_lock)
3d2430
+		idbm_unlock();
3d2430
 free_portal:
3d2430
 	free(portal);
3d2430
 	return rc;
3d2430
@@ -2357,18 +2391,24 @@ static int setup_disc_to_node_link(char *disc_portal, node_rec_t *rec)
3d2430
 int idbm_add_node(node_rec_t *newrec, discovery_rec_t *drec, int overwrite)
3d2430
 {
3d2430
 	node_rec_t rec;
3d2430
-	char *node_portal, *disc_portal;
3d2430
+	char *node_portal = NULL, *disc_portal;
3d2430
 	int rc;
3d2430
 
3d2430
+	rc = idbm_lock();
3d2430
+	if (rc)
3d2430
+		return rc;
3d2430
+
3d2430
 	if (!idbm_rec_read(&rec, newrec->name, newrec->tpgt,
3d2430
 			   newrec->conn[0].address, newrec->conn[0].port,
3d2430
-			   &newrec->iface)) {
3d2430
-		if (!overwrite)
3d2430
-			return 0;
3d2430
+			   &newrec->iface, true)) {
3d2430
+		if (!overwrite) {
3d2430
+			rc = 0;
3d2430
+			goto unlock;
3d2430
+		}
3d2430
 
3d2430
 		rc = idbm_delete_node(&rec);
3d2430
 		if (rc)
3d2430
-			return rc;
3d2430
+			goto unlock;
3d2430
 		log_debug(7, "overwriting existing record");
3d2430
 	} else
3d2430
 		log_debug(7, "adding new DB record");
3d2430
@@ -2379,17 +2419,19 @@ int idbm_add_node(node_rec_t *newrec, discovery_rec_t *drec, int overwrite)
3d2430
 		strcpy(newrec->disc_address, drec->address);
3d2430
 	}
3d2430
 
3d2430
-	rc = idbm_rec_write(newrec);
3d2430
+	rc = idbm_rec_write(newrec, true);
3d2430
 	/*
3d2430
 	 * if a old app passed in a bogus tpgt then we do not create links
3d2430
 	 * since it will set a different tpgt in another iscsiadm call
3d2430
 	 */
3d2430
 	if (rc || !drec || newrec->tpgt == PORTAL_GROUP_TAG_UNKNOWN)
3d2430
-		return rc;
3d2430
+		goto unlock;
3d2430
 
3d2430
 	node_portal = calloc(2, PATH_MAX);
3d2430
-	if (!node_portal)
3d2430
-		return ISCSI_ERR_NOMEM;
3d2430
+	if (!node_portal) {
3d2430
+		rc = ISCSI_ERR_NOMEM;
3d2430
+		goto unlock;
3d2430
+	}
3d2430
 
3d2430
 	disc_portal = node_portal + PATH_MAX;
3d2430
 	snprintf(node_portal, PATH_MAX, "%s/%s/%s,%d,%d", NODE_CONFIG_DIR,
3d2430
@@ -2397,15 +2439,11 @@ int idbm_add_node(node_rec_t *newrec, discovery_rec_t *drec, int overwrite)
3d2430
 		 newrec->tpgt);
3d2430
 	rc = setup_disc_to_node_link(disc_portal, newrec);
3d2430
 	if (rc)
3d2430
-		goto free_portal;
3d2430
+		goto unlock;
3d2430
 
3d2430
 	log_debug(7, "node addition making link from %s to %s", node_portal,
3d2430
 		 disc_portal);
3d2430
 
3d2430
-	rc = idbm_lock();
3d2430
-	if (rc)
3d2430
-		goto free_portal;
3d2430
-
3d2430
 	if (symlink(node_portal, disc_portal)) {
3d2430
 		if (errno == EEXIST)
3d2430
 			log_debug(7, "link from %s to %s exists", node_portal,
3d2430
@@ -2417,8 +2455,8 @@ int idbm_add_node(node_rec_t *newrec, discovery_rec_t *drec, int overwrite)
3d2430
 				 strerror(errno));
3d2430
 		}
3d2430
 	}
3d2430
+unlock:
3d2430
 	idbm_unlock();
3d2430
-free_portal:
3d2430
 	free(node_portal);
3d2430
 	return rc;
3d2430
 }
3d2430
@@ -2657,7 +2695,7 @@ static int idbm_remove_disc_to_node_link(node_rec_t *rec,
3d2430
 		 rec->name, rec->conn[0].address, rec->conn[0].port, rec->tpgt,
3d2430
 		 rec->iface.name);
3d2430
 
3d2430
-	rc = __idbm_rec_read(tmprec, portal);
3d2430
+	rc = __idbm_rec_read(tmprec, portal, false);
3d2430
 	if (rc) {
3d2430
 		/* old style recs will not have tpgt or a link so skip */
3d2430
 		rc = 0;
3d2430
@@ -2884,7 +2922,7 @@ int idbm_node_set_param(void *data, node_rec_t *rec)
3d2430
 	if (rc)
3d2430
 		return rc;
3d2430
 
3d2430
-	return idbm_rec_write(rec);
3d2430
+	return idbm_rec_write(rec, true);
3d2430
 }
3d2430
 
3d2430
 int idbm_discovery_set_param(void *data, discovery_rec_t *rec)
3d2430
diff --git a/usr/idbm.h b/usr/idbm.h
3d2430
index 411dd82..8571a8c 100644
3d2430
--- a/usr/idbm.h
3d2430
+++ b/usr/idbm.h
3d2430
@@ -23,6 +23,7 @@
3d2430
 #define IDBM_H
3d2430
 
3d2430
 #include <stdio.h>
3d2430
+#include <stdbool.h>
3d2430
 #include <sys/types.h>
3d2430
 #include "initiator.h"
3d2430
 #include "config.h"
3d2430
@@ -91,22 +92,22 @@ struct user_param {
3d2430
 };
3d2430
 
3d2430
 typedef int (idbm_iface_op_fn)(void *data, node_rec_t *rec);
3d2430
-typedef int (idbm_portal_op_fn)(int *found,  void *data,
3d2430
-				char *targetname, int tpgt, char *ip, int port);
3d2430
+typedef int (idbm_portal_op_fn)(int *found,  void *data, char *targetname,
3d2430
+				int tpgt, char *ip, int port, bool ruw_lock);
3d2430
 typedef int (idbm_node_op_fn)(int *found, void *data,
3d2430
-			      char *targetname);
3d2430
+			      char *targetname, bool ruw_lock);
3d2430
 
3d2430
 struct rec_op_data {
3d2430
 	void *data;
3d2430
 	node_rec_t *match_rec;
3d2430
 	idbm_iface_op_fn *fn;
3d2430
 };
3d2430
-extern int idbm_for_each_portal(int *found, void *data,
3d2430
-				idbm_portal_op_fn *fn, char *targetname);
3d2430
+extern int idbm_for_each_portal(int *found, void *data, idbm_portal_op_fn *fn,
3d2430
+				char *targetname, bool ruw_lock);
3d2430
 extern int idbm_for_each_node(int *found, void *data,
3d2430
-			      idbm_node_op_fn *fn);
3d2430
+			      idbm_node_op_fn *fn, bool ruw_lock);
3d2430
 extern int idbm_for_each_rec(int *found, void *data,
3d2430
-			     idbm_iface_op_fn *fn);
3d2430
+			     idbm_iface_op_fn *fn, bool ruw_lock);
3d2430
 
3d2430
 
3d2430
 typedef int (idbm_drec_op_fn)(void *data, discovery_rec_t *drec);
3d2430
@@ -145,7 +146,7 @@ extern int idbm_discovery_read(discovery_rec_t *rec, int type, char *addr,
3d2430
 				int port);
3d2430
 extern int idbm_rec_read(node_rec_t *out_rec, char *target_name,
3d2430
 			 int tpgt, char *addr, int port,
3d2430
-			 struct iface_rec *iface);
3d2430
+			 struct iface_rec *iface, bool disable_lock);
3d2430
 extern int idbm_node_set_rec_from_param(struct list_head *params,
3d2430
 					node_rec_t *rec, int verify);
3d2430
 extern int idbm_node_set_param(void *data, node_rec_t *rec);
3d2430
diff --git a/usr/iface.c b/usr/iface.c
3d2430
index 74e63f6..b2e6db6 100644
3d2430
--- a/usr/iface.c
3d2430
+++ b/usr/iface.c
3d2430
@@ -855,7 +855,7 @@ int iface_print_tree(void *data, struct iface_rec *iface)
3d2430
 	print_data.match_iface = iface;
3d2430
 	print_data.last_rec = &last_rec;
3d2430
 
3d2430
-	idbm_for_each_rec(&num_found, &print_data, iface_print_nodes);
3d2430
+	idbm_for_each_rec(&num_found, &print_data, iface_print_nodes, false);
3d2430
 	return 0;
3d2430
 }
3d2430
 
3d2430
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
3d2430
index 6245e89..c2b047e 100644
3d2430
--- a/usr/iscsiadm.c
3d2430
+++ b/usr/iscsiadm.c
3d2430
@@ -398,7 +398,7 @@ __logout_by_startup(void *data, struct list_head *list,
3d2430
 	memset(&rec, 0, sizeof(node_rec_t));
3d2430
 	if (idbm_rec_read(&rec, info->targetname, info->tpgt,
3d2430
 			  info->persistent_address,
3d2430
-			  info->persistent_port, &info->iface)) {
3d2430
+			  info->persistent_port, &info->iface, false)) {
3d2430
 		/*
3d2430
 		 * this is due to a HW driver or some other driver
3d2430
 		 * not hooked in
3d2430
@@ -515,7 +515,7 @@ login_by_startup(char *mode)
3d2430
 	startup.mode = mode;
3d2430
 	INIT_LIST_HEAD(&startup.all_logins);
3d2430
 	INIT_LIST_HEAD(&startup.leading_logins);
3d2430
-	err = idbm_for_each_rec(&nr_found, &startup, link_startup_recs);
3d2430
+	err = idbm_for_each_rec(&nr_found, &startup, link_startup_recs, false);
3d2430
 	if (err && (!list_empty(&startup.all_logins) ||
3d2430
 		    !list_empty(&startup.leading_logins)))
3d2430
 		/* log msg and try to log into what we found */
3d2430
@@ -662,7 +662,7 @@ static int __for_each_matched_rec(int verbose, struct node_rec *rec,
3d2430
 	op_data.match_rec = rec;
3d2430
 	op_data.fn = fn;
3d2430
 
3d2430
-	rc = idbm_for_each_rec(&nr_found, &op_data, rec_match_fn);
3d2430
+	rc = idbm_for_each_rec(&nr_found, &op_data, rec_match_fn, true);
3d2430
 	if (rc) {
3d2430
 		if (verbose)
3d2430
 			log_error("Could not execute operation on all "
3d2430
@@ -915,8 +915,8 @@ done:
3d2430
 	return rc;
3d2430
 }
3d2430
 
3d2430
-static int add_static_portal(int *found, void *data,
3d2430
-			     char *targetname, int tpgt, char *ip, int port)
3d2430
+static int add_static_portal(int *found, void *data, char *targetname,
3d2430
+			     int tpgt, char *ip, int port, bool ruw_lock)
3d2430
 {
3d2430
 	node_rec_t *rec = data;
3d2430
 
3d2430
@@ -932,7 +932,7 @@ static int add_static_portal(int *found, void *data,
3d2430
 }
3d2430
 
3d2430
 static int add_static_node(int *found, void *data,
3d2430
-			  char *targetname)
3d2430
+			  char *targetname, bool ruw_lock)
3d2430
 {
3d2430
 	node_rec_t *rec = data;
3d2430
 
3d2430
@@ -950,14 +950,14 @@ static int add_static_node(int *found, void *data,
3d2430
 			      rec->conn[0].port, &rec->iface);
3d2430
 search:
3d2430
 	return idbm_for_each_portal(found, data, add_static_portal,
3d2430
-				    targetname);
3d2430
+				    targetname, false);
3d2430
 }
3d2430
 
3d2430
 static int add_static_recs(struct node_rec *rec)
3d2430
 {
3d2430
 	int rc, nr_found = 0;
3d2430
 
3d2430
-	rc = idbm_for_each_node(&nr_found, rec, add_static_node);
3d2430
+	rc = idbm_for_each_node(&nr_found, rec, add_static_node, false);
3d2430
 	if (rc)
3d2430
 		goto done;
3d2430
 	/* success */
3d2430
@@ -1048,7 +1048,7 @@ exec_disc_op_on_recs(discovery_rec_t *drec, struct list_head *rec_list,
3d2430
 
3d2430
 	/* clean up node db */
3d2430
 	if (op & OP_DELETE)
3d2430
-		idbm_for_each_rec(&found, rec_list, delete_stale_rec);
3d2430
+		idbm_for_each_rec(&found, rec_list, delete_stale_rec, false);
3d2430
 
3d2430
 	if (op & OP_NEW || op & OP_UPDATE) {
3d2430
 		/* now add/update records */
3d2430
diff --git a/usr/iscsid.c b/usr/iscsid.c
3d2430
index f0017e5..01b90c9 100644
3d2430
--- a/usr/iscsid.c
3d2430
+++ b/usr/iscsid.c
3d2430
@@ -233,7 +233,7 @@ static int sync_session(void *data, struct session_info *info)
3d2430
 
3d2430
 	if (idbm_rec_read(&rec, info->targetname, info->tpgt,
3d2430
 			  info->persistent_address, info->persistent_port,
3d2430
-			  &info->iface)) {
3d2430
+			  &info->iface, false)) {
3d2430
 		log_warning("Could not read data from db. Using default and "
3d2430
 			    "currently negotiated values");
3d2430
 		setup_rec_from_negotiated_values(&rec, info);
3d2430
-- 
3d2430
2.21.0
3d2430