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:53 -0700
commit141d78e170b1e35b8897fe583cb5955646c8c211 (patch)
tree2da2e31dc1bd8a99b48bcea8590a88c2a8fc315b /xlators/protocol
parenteeeffd41703003be30b3f1811fa54f5f8047ed73 (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 09671368..d255107f 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);