diff options
-rw-r--r-- | rpc/xdr/src/glusterfs3-xdr.x | 2 | ||||
-rw-r--r-- | rpc/xdr/src/glusterfs3.h | 15 | ||||
-rw-r--r-- | xlators/protocol/client/src/client-callback.c | 5 | ||||
-rw-r--r-- | xlators/protocol/server/src/server.c | 2 |
4 files changed, 16 insertions, 8 deletions
diff --git a/rpc/xdr/src/glusterfs3-xdr.x b/rpc/xdr/src/glusterfs3-xdr.x index f0cd4cbc953..5304a26da3a 100644 --- a/rpc/xdr/src/glusterfs3-xdr.x +++ b/rpc/xdr/src/glusterfs3-xdr.x @@ -45,7 +45,7 @@ struct gf_iatt { struct gfs3_cbk_cache_invalidation_req { - opaque gfid[16]; + string gfid<>; unsigned int event_type; /* Upcall event type */ unsigned int flags; /* or mask of events incase of inotify */ unsigned int expire_time_attr; /* the amount of time which client diff --git a/rpc/xdr/src/glusterfs3.h b/rpc/xdr/src/glusterfs3.h index 2acdfc756c4..6808064cb95 100644 --- a/rpc/xdr/src/glusterfs3.h +++ b/rpc/xdr/src/glusterfs3.h @@ -273,6 +273,7 @@ gf_proto_cache_invalidation_from_upcall (gfs3_cbk_cache_invalidation_req *gf_c_r { struct gf_upcall_cache_invalidation *gf_c_data = NULL; int is_cache_inval = 0; + int ret = -1; GF_VALIDATE_OR_GOTO(THIS->name, gf_c_req, out); GF_VALIDATE_OR_GOTO(THIS->name, gf_up_data, out); @@ -284,7 +285,7 @@ gf_proto_cache_invalidation_from_upcall (gfs3_cbk_cache_invalidation_req *gf_c_r gf_c_data = (struct gf_upcall_cache_invalidation *)gf_up_data->data; GF_VALIDATE_OR_GOTO(THIS->name, gf_c_data, out); - memcpy (gf_c_req->gfid, gf_up_data->gfid, 16); + gf_c_req->gfid = uuid_utoa (gf_up_data->gfid); gf_c_req->event_type = gf_up_data->event_type; gf_c_req->flags = gf_c_data->flags; gf_c_req->expire_time_attr = gf_c_data->expire_time_attr; @@ -298,6 +299,7 @@ gf_proto_cache_invalidation_to_upcall (gfs3_cbk_cache_invalidation_req *gf_c_req struct gf_upcall *gf_up_data) { struct gf_upcall_cache_invalidation *gf_c_data = NULL; + int ret = -1; GF_VALIDATE_OR_GOTO(THIS->name, gf_c_req, out); GF_VALIDATE_OR_GOTO(THIS->name, gf_up_data, out); @@ -305,8 +307,15 @@ gf_proto_cache_invalidation_to_upcall (gfs3_cbk_cache_invalidation_req *gf_c_req gf_c_data = (struct gf_upcall_cache_invalidation *)gf_up_data->data; GF_VALIDATE_OR_GOTO(THIS->name, gf_c_data, out); - memcpy (gf_up_data->gfid, gf_c_req->gfid, 16); - gf_up_data->event_type = gf_c_req->event_type; + ret = gf_uuid_parse (gf_c_req->gfid, gf_up_data->gfid); + if (ret) { + gf_log (THIS->name, GF_LOG_WARNING, "gf_uuid_parse(%s) failed", + gf_c_req->gfid); + gf_up_data->event_type = GF_UPCALL_EVENT_NULL; + return; + } + + gf_up_data->event_type = gf_c_req->event_type; gf_c_data->flags = gf_c_req->flags; gf_c_data->expire_time_attr = gf_c_req->expire_time_attr; diff --git a/xlators/protocol/client/src/client-callback.c b/xlators/protocol/client/src/client-callback.c index 722db7d0f5f..78b9cef197d 100644 --- a/xlators/protocol/client/src/client-callback.c +++ b/xlators/protocol/client/src/client-callback.c @@ -49,7 +49,7 @@ client_cbk_cache_invalidation (struct rpc_clnt *rpc, void *mydata, void *data) struct gf_upcall upcall_data = {0,}; uuid_t gfid; struct gf_upcall_cache_invalidation ca_data = {0,}; - gfs3_cbk_cache_invalidation_req ca_req = {{0,},}; + gfs3_cbk_cache_invalidation_req ca_req = {0,}; gf_log (THIS->name, GF_LOG_TRACE, "Upcall callback is called"); @@ -69,9 +69,8 @@ client_cbk_cache_invalidation (struct rpc_clnt *rpc, void *mydata, void *data) upcall_data.data = &ca_data; gf_proto_cache_invalidation_to_upcall (&ca_req, &upcall_data); - memcpy (gfid, ca_req.gfid, 16); gf_log (THIS->name, GF_LOG_TRACE, "Upcall gfid = %s, ret = %d", - uuid_utoa (gfid), ret); + ca_req.gfid, ret); default_notify (THIS, GF_EVENT_UPCALL, &upcall_data); diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index bdb9bae9cb6..a148646e215 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -1124,7 +1124,7 @@ server_process_event_upcall (xlator_t *this, void *data) void *up_req = NULL; rpc_transport_t *xprt = NULL; enum gf_cbk_procnum cbk_procnum = GF_CBK_NULL; - gfs3_cbk_cache_invalidation_req gf_c_req = {{0,},}; + gfs3_cbk_cache_invalidation_req gf_c_req = {0,}; xdrproc_t xdrproc; GF_VALIDATE_OR_GOTO(this->name, data, out); |