diff options
| author | Soumya Koduri <skoduri@redhat.com> | 2015-02-16 11:47:58 +0530 | 
|---|---|---|
| committer | Kaleb KEITHLEY <kkeithle@redhat.com> | 2015-03-17 14:01:21 -0700 | 
| commit | 2a4561ef08b8be3b7d79b951252e87ba8f987120 (patch) | |
| tree | ed5cc0c87f6532b167ebb2b775389a9a391a3cf4 /xlators/protocol/client/src/client-callback.c | |
| parent | d81182cf69a4f188f304fcce6d651ffd56b67aac (diff) | |
gfapi: APIs to store and process upcall notifications received
In case of any upcall cbk events received by the protocol/client,
gfapi will be notified which queues them up in a list (<gfapi_cbk_upcall>).
Applicatons are responsible to provide APIs to process & notify them in case
of any such upcall events queued.
Added a new API which will be used by Ganesha to repeatedly poll for any
such upcall event notified (<glfs_h_poll_upcall>).
A new test-file has been added to test the cache_invalidation upcall events.
Below link has a writeup which explains the code changes done -
        URL: https://soumyakoduri.wordpress.com/2015/02/25/glusterfs-understanding-upcall-infrastructure-and-cache-invalidation-support/
Change-Id: Iafc6880000c865fd4da22d0cfc388ec135b5a1c5
BUG: 1200262
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
Reviewed-on: http://review.gluster.org/9536
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'xlators/protocol/client/src/client-callback.c')
| -rw-r--r-- | xlators/protocol/client/src/client-callback.c | 34 | 
1 files changed, 34 insertions, 0 deletions
| diff --git a/xlators/protocol/client/src/client-callback.c b/xlators/protocol/client/src/client-callback.c index b2707cb395b..fdfb3dc313b 100644 --- a/xlators/protocol/client/src/client-callback.c +++ b/xlators/protocol/client/src/client-callback.c @@ -15,6 +15,7 @@  #include "client.h"  #include "rpc-clnt.h" +#include "defaults.h"  int  client_cbk_null (struct rpc_clnt *rpc, void *mydata, void *data) @@ -40,10 +41,43 @@ client_cbk_ino_flush (struct rpc_clnt *rpc, void *mydata, void *data)          return 0;  } +int +client_cbk_upcall (struct rpc_clnt *rpc, void *mydata, void *data) +{ +        int              ret          = -1; +        gfs3_upcall_req  up_req; +        struct gf_upcall upcall_data; +        struct iovec     *iov         = NULL; + +        gf_log (THIS->name, GF_LOG_TRACE, +                "Upcall callback is called"); + +        if (!rpc || !mydata || !data) +                goto out; + +        iov = (struct iovec *)data; +        ret =  xdr_to_generic (*iov, &up_req, +                               (xdrproc_t)xdr_gfs3_upcall_req); + +        if (ret < 0) +                goto out; + +        gf_proto_upcall_to_upcall (&up_req, &upcall_data); + +        gf_log (THIS->name, GF_LOG_TRACE, "Upcall gfid = %s, ret = %d", +                 (char *)(up_req.gfid), ret); + +        default_notify (THIS, GF_EVENT_UPCALL, &upcall_data); + +out: +        return 0; +} +  rpcclnt_cb_actor_t gluster_cbk_actors[GF_CBK_MAXVALUE] = {          [GF_CBK_NULL]      = {"NULL",      GF_CBK_NULL,      client_cbk_null },          [GF_CBK_FETCHSPEC] = {"FETCHSPEC", GF_CBK_FETCHSPEC, client_cbk_fetchspec },          [GF_CBK_INO_FLUSH] = {"INO_FLUSH", GF_CBK_INO_FLUSH, client_cbk_ino_flush }, +        [GF_CBK_UPCALL]    = {"UPCALL",    GF_CBK_UPCALL,    client_cbk_upcall },  }; | 
