summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>2017-07-13 00:01:36 +0530
committerPrasanna Kumar Kalever <prasanna.kalever@redhat.com>2017-07-13 00:31:54 +0530
commitc6295a4e56375e252a43f34d7d6fa8a804a9a732 (patch)
treefa5cf4178bbe99ac07ccb2541644cefbf9ed1370
parentf2e46779c0175e5063ce07256023f1977b333f2d (diff)
create: move saveconfig out of the loop
In the previous patch, `commit f2e46779c0175e5063ce07256023f1977b333f2d Author: Prasanna Kumar Kalever <prasanna.kalever@redhat.com> Date: Fri Jul 7 15:51:38 2017 +0530 tcmu: backstore attribute set cmd_time_out=0 [...]` unintentionally saveconfig was left inside the loop. Hence fixing this by pushing it outside. Problem: Currently, while populating 'exec' variable the following line after saveconfig i.e. at line GB_FREE(tmp); the 'tmp' variable is made NULL; Hence in each loop, condition if(!tmp) is always true, and the 'else' set of statements will never be executed. Impact: On block create with HA > 1, only for Nth(last) node portal gets created for rest of the nodes portal and their attr will never be created/set. As a result block is not exported correctly. Also, remove duplicated DEVNULLPATH redirection with attr setting Change-Id: I1f77461de6b89af4e4af098e0444ea3526669030 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
-rw-r--r--rpc/block_svc_routines.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/rpc/block_svc_routines.c b/rpc/block_svc_routines.c
index 5f7370f..2317703 100644
--- a/rpc/block_svc_routines.c
+++ b/rpc/block_svc_routines.c
@@ -2027,10 +2027,9 @@ block_create_1_svc(blockCreate *blk, struct svc_req *rqstp)
goto out;
}
} else {
- if (GB_ASPRINTF(&attr, "%s/%s%s/tpg%zu set attribute tpg_enabled_sendtargets=0 %s %s > %s",
+ if (GB_ASPRINTF(&attr, "%s/%s%s/tpg%zu set attribute tpg_enabled_sendtargets=0 %s %s",
GB_TGCLI_ISCSI, GB_TGCLI_IQN_PREFIX, blk->gbid, i,
- blk->auth_mode?"authentication=1":"",
- GB_TGCLI_ATTRIBUTES, DEVNULLPATH) == -1) {
+ blk->auth_mode?"authentication=1":"", GB_TGCLI_ATTRIBUTES) == -1) {
goto out;
}
if (GB_ASPRINTF(&portal, "%s/%s%s/tpg%zu/portals create %s > %s",
@@ -2063,17 +2062,17 @@ block_create_1_svc(blockCreate *blk, struct svc_req *rqstp)
tmp = exec;
}
- if (GB_ASPRINTF(&exec, "%s && %s", tmp, GB_TGCLI_SAVE) == -1) {
- goto out;
- }
- GB_FREE(tmp);
-
GB_FREE(authcred);
GB_FREE(attr);
GB_FREE(portal);
GB_FREE(lun);
}
+ if (GB_ASPRINTF(&exec, "%s && %s", tmp, GB_TGCLI_SAVE) == -1) {
+ goto out;
+ }
+ GB_FREE(tmp);
+
LOG("mgmt", GB_LOG_DEBUG, "command, %s", exec);
if (GB_ALLOC_N(reply->out, 4096) < 0) {