summaryrefslogtreecommitdiffstats
path: root/xlators/features/upcall/src
diff options
context:
space:
mode:
authorSoumya Koduri <skoduri@redhat.com>2015-06-12 13:45:09 +0530
committerKaleb KEITHLEY <kkeithle@redhat.com>2015-06-27 16:22:51 -0700
commitb68f671b2b8a0aafef8f98145aee7044edaa907d (patch)
tree96a8e2d6a252692887161b3e255aae2cf1db62ce /xlators/features/upcall/src
parent58a736111fa1db4f10c6646e81066434260f674f (diff)
Upcall/gfapi: Return ENOTSUP when upcall feature is disabled
Changes to detect the list of upcall events enabled using GF_FOP_IPC and return ENOTSUP to applications in case if they poll for any of the events disabled. Change-Id: Icc748054ef903598288119dbe99b1e337174662a BUG: 1231132 Signed-off-by: Niels de Vos <ndevos@redhat.com> Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/11196 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Tested-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'xlators/features/upcall/src')
-rw-r--r--xlators/features/upcall/src/upcall.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/xlators/features/upcall/src/upcall.c b/xlators/features/upcall/src/upcall.c
index 4954d43db07..bb29866543b 100644
--- a/xlators/features/upcall/src/upcall.c
+++ b/xlators/features/upcall/src/upcall.c
@@ -1552,6 +1552,52 @@ err:
}
int32_t
+up_ipc (call_frame_t *frame, xlator_t *this, int32_t op, dict_t *xdata)
+{
+ int ret = 0;
+ uint32_t features = 0;
+
+ /* upcall only has one IPC operation */
+ if (op != GF_IPC_UPCALL_FEATURES)
+ goto wind;
+
+ if (!xdata) {
+ xdata = dict_new();
+ if (!xdata) {
+ ret = -1;
+ goto unwind;
+ }
+ } else {
+ /* take an extra reference so that we can unconditionally unref
+ * it later */
+ dict_ref (xdata);
+ }
+
+ /* build the feature bitmask */
+ if (is_upcall_enabled(this))
+ features |= (1 << GF_UPCALL_EVENT_NULL);
+
+ /* check if 'GF_UPCALL_CACHE_INVALIDATION' is available */
+ if (is_cache_invalidation_enabled(this))
+ features |= (1 << GF_UPCALL_CACHE_INVALIDATION);
+
+ ret = dict_set_uint32 (xdata, GF_UPCALL_FEATURES, features);
+
+unwind:
+ UPCALL_STACK_UNWIND (ipc, frame, ret, errno, xdata);
+
+ dict_unref (xdata);
+
+ return 0;
+
+wind:
+ STACK_WIND (frame, default_ipc_cbk, FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->ipc, op, xdata);
+
+ return 0;
+}
+
+int32_t
mem_acct_init (xlator_t *this)
{
int ret = -1;
@@ -1813,6 +1859,9 @@ struct xlator_fops fops = {
.rmdir = up_rmdir,
.rename = up_rename,
+ /* xlator internal communication */
+ .ipc = up_ipc,
+
#ifdef NOT_SUPPORTED
/* internal lk fops */
.inodelk = up_inodelk,