diff options
Diffstat (limited to 'xlators/features')
-rw-r--r-- | xlators/features/locks/src/posix.c | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index a8e139c6ad3..4f5744025d8 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -1436,8 +1436,9 @@ pl_fgetxattr_handle_lockinfo(xlator_t *this, fd_t *fd, dict_t *dict, goto out; } - len = dict_serialized_length(tmp); - if (len < 0) { + op_ret = dict_allocate_and_serialize(tmp, (char **)&buf, + (unsigned int *)&len); + if (op_ret != 0) { *op_errno = -op_ret; op_ret = -1; gf_log(this->name, GF_LOG_WARNING, @@ -1447,24 +1448,6 @@ pl_fgetxattr_handle_lockinfo(xlator_t *this, fd_t *fd, dict_t *dict, goto out; } - buf = GF_CALLOC(1, len, gf_common_mt_char); - if (buf == NULL) { - op_ret = -1; - *op_errno = ENOMEM; - goto out; - } - - op_ret = dict_serialize(tmp, buf); - if (op_ret < 0) { - *op_errno = -op_ret; - op_ret = -1; - gf_log(this->name, GF_LOG_WARNING, - "dict_serialize failed (%s) while handling lockinfo " - "for fd (ptr: %p inode-gfid:%s)", - strerror(*op_errno), fd, uuid_utoa(fd->inode->gfid)); - goto out; - } - op_ret = dict_set_dynptr(dict, GF_XATTR_LOCKINFO_KEY, buf, len); if (op_ret < 0) { *op_errno = -op_ret; |