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

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at http://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to