diff options
author | Anuradha Talur <atalur@commvault.com> | 2019-04-24 12:35:08 -0700 |
---|---|---|
committer | Susant Palai <spalai@redhat.com> | 2019-04-26 17:36:14 +0000 |
commit | e10946dbfe18204d3e4a50e218ac3dbdab82a3a9 (patch) | |
tree | 71db7f624f3fc75bde60d3658a734560584bc0bf | |
parent | 68138b00ca0d093304a903544d13d0010e7ffcc1 (diff) |
cloudsync: Fix bug in cloudsync-fops-c.py
In some of the fops generated by generator.py, xdata request
was not being wound to the child xlator correctly.
This was happening because when though the logic in
cloudsync-fops-c.py was correct, generator.py was generating
a resultant code that omits this logic.
Made changes in cloudsync-fops-c.py so that correct code is
produced.
Change-Id: I6f25bdb36ede06fd03be32c04087a75639d79150
updates: bz#1642168
Signed-off-by: Anuradha Talur <atalur@commvault.com>
-rwxr-xr-x | xlators/features/cloudsync/src/cloudsync-fops-c.py | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/xlators/features/cloudsync/src/cloudsync-fops-c.py b/xlators/features/cloudsync/src/cloudsync-fops-c.py index 8878b70a715..c444ea621a8 100755 --- a/xlators/features/cloudsync/src/cloudsync-fops-c.py +++ b/xlators/features/cloudsync/src/cloudsync-fops-c.py @@ -39,7 +39,15 @@ cs_@NAME@ (call_frame_t *frame, xlator_t *this, else state = GF_CS_LOCAL; - local->xattr_req = xdata ? dict_ref (xdata) : (xdata = dict_new ()); + xdata = xdata ? dict_ref (xdata) : dict_new (); + + if (!xdata) { + gf_msg (this->name, GF_LOG_ERROR, 0, 0, "insufficient memory"); + op_errno = ENOMEM; + goto err; + } + + local->xattr_req = xdata; ret = dict_set_uint32 (local->xattr_req, GF_CS_OBJECT_STATUS, 1); if (ret) { @@ -187,19 +195,29 @@ int32_t cs_@NAME@ (call_frame_t *frame, xlator_t *this, @LONG_ARGS@) { + int op_errno = EINVAL; cs_local_t *local = NULL; int ret = 0; local = cs_local_init (this, frame, loc, NULL, GF_FOP_@UPNAME@); if (!local) { gf_msg (this->name, GF_LOG_ERROR, 0, 0, "local is NULL"); + op_errno = ENOMEM; goto err; } if (loc->inode->ia_type == IA_IFDIR) goto wind; - local->xattr_req = xdata ? dict_ref (xdata) : dict_new (); + xdata = xdata ? dict_ref (xdata) : dict_new (); + + if (!xdata) { + gf_msg (this->name, GF_LOG_ERROR, 0, 0, "insufficient memory"); + op_errno = ENOMEM; + goto err; + } + + local->xattr_req = xdata; ret = dict_set_uint32 (local->xattr_req, GF_CS_OBJECT_STATUS, 1); if (ret) { @@ -215,7 +233,7 @@ wind: return 0; err: - CS_STACK_UNWIND (@NAME@, frame, -1, errno, @CBK_ERROR_ARGS@); + CS_STACK_UNWIND (@NAME@, frame, -1, op_errno, @CBK_ERROR_ARGS@); return 0; } |