summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2019-06-05 20:16:40 +0300
committerAtin Mukherjee <amukherj@redhat.com>2019-07-16 13:34:56 +0000
commit7162c8ad9d404773656b4eb02c8fc17f067e7699 (patch)
treea83da6e6b2be8f4e38d83947347dad9ffb1ffa91 /api
parent6bf9637a93011298d032332ca93009ba4e377e46 (diff)
cli: defer create_frame() (and dict creation) to later stages.
Where possible, defer create_frame() - whenever possible, after command line verification, for example. Change-Id: Id6606e90e7ea6190f30b225c4733b229c519bb2f updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'api')
-rw-r--r--api/src/glfs-mgmt.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/api/src/glfs-mgmt.c b/api/src/glfs-mgmt.c
index 66a13432f38..3072d6979f0 100644
--- a/api/src/glfs-mgmt.c
+++ b/api/src/glfs-mgmt.c
@@ -767,7 +767,7 @@ glfs_volfile_fetch(struct glfs *fs)
gf_getspec_req req = {
0,
};
- int ret = 0;
+ int ret = -1;
call_frame_t *frame = NULL;
glusterfs_ctx_t *ctx = NULL;
dict_t *dict = NULL;
@@ -775,14 +775,11 @@ glfs_volfile_fetch(struct glfs *fs)
ctx = fs->ctx;
cmd_args = &ctx->cmd_args;
- frame = create_frame(THIS, ctx->pool);
-
req.key = cmd_args->volfile_id;
req.flags = 0;
dict = dict_new();
if (!dict) {
- ret = -1;
goto out;
}
@@ -815,6 +812,12 @@ glfs_volfile_fetch(struct glfs *fs)
goto out;
}
+ frame = create_frame(THIS, ctx->pool);
+ if (!frame) {
+ ret = -1;
+ goto out;
+ }
+
ret = mgmt_submit_request(&req, frame, ctx, &clnt_handshake_prog,
GF_HNDSK_GETSPEC, glfs_mgmt_getspec_cbk,
(xdrproc_t)xdr_gf_getspec_req);