summaryrefslogtreecommitdiffstats
path: root/xlators/protocol
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@zresearch.com>2009-06-30 00:15:34 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-06-30 15:24:54 -0700
commitfccb91cba86a8219191d7f241f4c6a722d512b4e (patch)
tree98542b5501c83c36428181ec10147da7ca0c07dc /xlators/protocol
parenta0e8c18dbb8e905ebecffd75096c9469fa922165 (diff)
client_xattrop: use dict_allocate_and_serialize during serializing xattr
- though the previous commit fixes bug #29, this patch fixes bugs arising in similar situations where xattrop is initiated by xlators other than afr. Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
Diffstat (limited to 'xlators/protocol')
-rw-r--r--xlators/protocol/client/src/client-protocol.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c
index 16f398b6a..d37fdf13d 100644
--- a/xlators/protocol/client/src/client-protocol.c
+++ b/xlators/protocol/client/src/client-protocol.c
@@ -1875,14 +1875,15 @@ client_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc,
int32_t ret = -1;
size_t pathlen = 0;
ino_t ino = 0;
+ char *buf = NULL;
GF_VALIDATE_OR_GOTO("client", this, unwind);
GF_VALIDATE_OR_GOTO(this->name, loc, unwind);
if (dict) {
- dict_len = dict_serialized_length (dict);
- if (dict_len < 0) {
+ ret = dict_allocate_and_serialize (dict, &buf, &dict_len);
+ if (ret < 0) {
gf_log (this->name, GF_LOG_DEBUG,
"failed to get serialized length of dict(%p)",
dict);
@@ -1909,14 +1910,10 @@ client_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc,
req->flags = hton32 (flags);
req->dict_len = hton32 (dict_len);
if (dict) {
- ret = dict_serialize (dict, req->dict);
- if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to serialize dictionary(%p)",
- dict);
- goto unwind;
- }
- }
+ memcpy (req->dict, buf, dict_len);
+ FREE (buf);
+ }
+
req->ino = hton64 (ino);
strcpy (req->path + dict_len, loc->path);