Blame open-iscsi-v2.0.873-4c9d6f9-1-idmb_rec_write-check-for-tpgt-first.patch

2abe1f
From 974339c4e2f8321057bb5a28611433bbd5e28463 Mon Sep 17 00:00:00 2001
c2d5d2
From: Chris Leech <cleech@redhat.com>
c2d5d2
Date: Tue, 13 Aug 2013 10:59:44 -0700
929689
Subject: [PATCH] idmb_rec_write, check for tpgt first
c2d5d2
c2d5d2
Factor out the check for a tpgt to a single place, before going crazy on
c2d5d2
the rec files.  Makes flow of this function easier to follow, and preps
c2d5d2
for splitting it up.
c2d5d2
---
c2d5d2
 usr/idbm.c | 18 +++++-------------
c2d5d2
 1 file changed, 5 insertions(+), 13 deletions(-)
c2d5d2
c2d5d2
diff --git a/usr/idbm.c b/usr/idbm.c
929689
index 198a5ef..caec94f 100644
c2d5d2
--- a/usr/idbm.c
c2d5d2
+++ b/usr/idbm.c
929689
@@ -2041,6 +2041,10 @@ static int idbm_rec_write(node_rec_t *rec)
c2d5d2
 	if (rc)
c2d5d2
 		goto free_portal;
c2d5d2
 
c2d5d2
+	if (rec->tpgt == PORTAL_GROUP_TAG_UNKNOWN)
c2d5d2
+		/* drop down to old style portal as config */
c2d5d2
+		goto open_conf;
c2d5d2
+
c2d5d2
 	rc = stat(portal, &statb);
c2d5d2
 	if (rc) {
c2d5d2
 		rc = 0;
929689
@@ -2049,23 +2053,11 @@ static int idbm_rec_write(node_rec_t *rec)
c2d5d2
 		 * set the tgpt. In new versions you must pass all the info in
c2d5d2
 		 * from the start
c2d5d2
 		 */
c2d5d2
-		if (rec->tpgt == PORTAL_GROUP_TAG_UNKNOWN)
c2d5d2
-			/* drop down to old style portal as config */
c2d5d2
-			goto open_conf;
c2d5d2
-		else
c2d5d2
-			goto mkdir_portal;
c2d5d2
+		goto mkdir_portal;
c2d5d2
 	}
c2d5d2
 
c2d5d2
 	if (!S_ISDIR(statb.st_mode)) {
c2d5d2
 		/*
c2d5d2
-		 * older iscsiadm versions had you create the config then set
c2d5d2
-		 * set the tgpt. In new versions you must pass all the info in
c2d5d2
-		 * from the start
c2d5d2
-		 */
c2d5d2
-		if (rec->tpgt == PORTAL_GROUP_TAG_UNKNOWN)
c2d5d2
-			/* drop down to old style portal as config */
c2d5d2
-			goto open_conf;
c2d5d2
-		/*
c2d5d2
 		 * Old style portal as a file, but with tpgt. Let's update it.
c2d5d2
 		 */
c2d5d2
 		if (unlink(portal)) {
c2d5d2
-- 
929689
2.1.0
c2d5d2