Blame SOURCES/0143-idmb_rec_write-check-for-tpgt-first.patch

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