|
|
3604df |
From 146944dc7f608f8a9c0034f8d308d0deff32adfa Mon Sep 17 00:00:00 2001
|
|
|
3604df |
From: Niels de Vos <ndevos@redhat.com>
|
|
|
3604df |
Date: Mon, 7 Dec 2015 16:24:15 +0000
|
|
|
3604df |
Subject: [PATCH 111/141] upcall: Add support to invalidate xattrs
|
|
|
3604df |
|
|
|
3604df |
When SElinux is used, clients should get a notification that the
|
|
|
3604df |
extended attributes have been updated. Other components (like md-cache)
|
|
|
3604df |
will be able to use this too.
|
|
|
3604df |
|
|
|
3604df |
A big part of the implementation comes from Poornima through the first
|
|
|
3604df |
version of http://review.gluster.org/12996.
|
|
|
3604df |
|
|
|
3604df |
Also moving the flags from upcall-cache-invalidation.h to the main
|
|
|
3604df |
libglusterfs upcall-utils.h file, so that other places can easily use
|
|
|
3604df |
them in future.
|
|
|
3604df |
|
|
|
3604df |
Change-Id: I525345bed8f22d029524ff19ccaf726a2c905454
|
|
|
3604df |
BUG: 1284873
|
|
|
3604df |
Signed-off-by: Niels de Vos <ndevos@redhat.com>
|
|
|
3604df |
Signed-off-by: Poornima G <pgurusid@redhat.com>
|
|
|
3604df |
Reviewed-on: http://review.gluster.org/12995
|
|
|
3604df |
Reviewed-by: soumya k <skoduri@redhat.com>
|
|
|
3604df |
Smoke: Gluster Build System <jenkins@build.gluster.com>
|
|
|
3604df |
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
3604df |
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
|
|
|
3604df |
Reviewed-on: https://code.engineering.redhat.com/gerrit/87024
|
|
|
3604df |
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
|
|
|
3604df |
Tested-by: Rajesh Joseph <rjoseph@redhat.com>
|
|
|
3604df |
---
|
|
|
3604df |
libglusterfs/src/upcall-utils.h | 40 +++
|
|
|
3604df |
.../upcall/src/upcall-cache-invalidation.h | 34 --
|
|
|
3604df |
xlators/features/upcall/src/upcall-internal.c | 22 +--
|
|
|
3604df |
xlators/features/upcall/src/upcall.c | 346 +++++++++++++++++++-
|
|
|
3604df |
xlators/features/upcall/src/upcall.h | 2 +-
|
|
|
3604df |
5 files changed, 381 insertions(+), 63 deletions(-)
|
|
|
3604df |
|
|
|
3604df |
diff --git a/libglusterfs/src/upcall-utils.h b/libglusterfs/src/upcall-utils.h
|
|
|
3604df |
index 78db806..614276f 100644
|
|
|
3604df |
--- a/libglusterfs/src/upcall-utils.h
|
|
|
3604df |
+++ b/libglusterfs/src/upcall-utils.h
|
|
|
3604df |
@@ -15,6 +15,46 @@
|
|
|
3604df |
#include "compat-uuid.h"
|
|
|
3604df |
#include "compat.h"
|
|
|
3604df |
|
|
|
3604df |
+/* Flags sent for cache_invalidation */
|
|
|
3604df |
+#define UP_NLINK 0x00000001 /* update nlink */
|
|
|
3604df |
+#define UP_MODE 0x00000002 /* update mode and ctime */
|
|
|
3604df |
+#define UP_OWN 0x00000004 /* update mode,uid,gid and ctime */
|
|
|
3604df |
+#define UP_SIZE 0x00000008 /* update fsize */
|
|
|
3604df |
+#define UP_TIMES 0x00000010 /* update all times */
|
|
|
3604df |
+#define UP_ATIME 0x00000020 /* update atime only */
|
|
|
3604df |
+#define UP_PERM 0x00000040 /* update fields needed for permission
|
|
|
3604df |
+ checking */
|
|
|
3604df |
+#define UP_RENAME 0x00000080 /* this is a rename op - delete the cache
|
|
|
3604df |
+ entry */
|
|
|
3604df |
+#define UP_FORGET 0x00000100 /* inode_forget on server side -
|
|
|
3604df |
+ invalidate the cache entry */
|
|
|
3604df |
+#define UP_PARENT_TIMES 0x00000200 /* update parent dir times */
|
|
|
3604df |
+
|
|
|
3604df |
+#define UP_XATTR 0x00000400 /* update the xattrs and ctime */
|
|
|
3604df |
+#define UP_XATTR_RM 0x00000800 /* Remove the xattrs and update ctime */
|
|
|
3604df |
+
|
|
|
3604df |
+/* for fops - open, read, lk, */
|
|
|
3604df |
+#define UP_UPDATE_CLIENT (UP_ATIME)
|
|
|
3604df |
+
|
|
|
3604df |
+/* for fop - write, truncate */
|
|
|
3604df |
+#define UP_WRITE_FLAGS (UP_SIZE | UP_TIMES)
|
|
|
3604df |
+
|
|
|
3604df |
+/* for fop - setattr */
|
|
|
3604df |
+#define UP_ATTR_FLAGS (UP_SIZE | UP_TIMES | UP_OWN | UP_MODE | \
|
|
|
3604df |
+ UP_PERM)
|
|
|
3604df |
+/* for fop - rename */
|
|
|
3604df |
+#define UP_RENAME_FLAGS (UP_RENAME)
|
|
|
3604df |
+
|
|
|
3604df |
+/* to invalidate parent directory entries for fops -rename, unlink, rmdir,
|
|
|
3604df |
+ * mkdir, create */
|
|
|
3604df |
+#define UP_PARENT_DENTRY_FLAGS (UP_PARENT_TIMES)
|
|
|
3604df |
+
|
|
|
3604df |
+/* for fop - unlink, link, rmdir, mkdir */
|
|
|
3604df |
+#define UP_NLINK_FLAGS (UP_NLINK | UP_TIMES)
|
|
|
3604df |
+
|
|
|
3604df |
+#define IATT_UPDATE_FLAGS (UP_NLINK | UP_MODE | UP_OWN | UP_SIZE | \
|
|
|
3604df |
+ UP_TIMES | UP_ATIME)
|
|
|
3604df |
+
|
|
|
3604df |
typedef enum {
|
|
|
3604df |
GF_UPCALL_EVENT_NULL,
|
|
|
3604df |
GF_UPCALL_CACHE_INVALIDATION,
|
|
|
3604df |
diff --git a/xlators/features/upcall/src/upcall-cache-invalidation.h b/xlators/features/upcall/src/upcall-cache-invalidation.h
|
|
|
3604df |
index 964a72f..62b458f 100644
|
|
|
3604df |
--- a/xlators/features/upcall/src/upcall-cache-invalidation.h
|
|
|
3604df |
+++ b/xlators/features/upcall/src/upcall-cache-invalidation.h
|
|
|
3604df |
@@ -15,40 +15,6 @@
|
|
|
3604df |
* events post its last access */
|
|
|
3604df |
#define CACHE_INVALIDATION_TIMEOUT "60"
|
|
|
3604df |
|
|
|
3604df |
-/* Flags sent for cache_invalidation */
|
|
|
3604df |
-#define UP_NLINK 0x00000001 /* update nlink */
|
|
|
3604df |
-#define UP_MODE 0x00000002 /* update mode and ctime */
|
|
|
3604df |
-#define UP_OWN 0x00000004 /* update mode,uid,gid and ctime */
|
|
|
3604df |
-#define UP_SIZE 0x00000008 /* update fsize */
|
|
|
3604df |
-#define UP_TIMES 0x00000010 /* update all times */
|
|
|
3604df |
-#define UP_ATIME 0x00000020 /* update atime only */
|
|
|
3604df |
-#define UP_PERM 0x00000040 /* update fields needed for
|
|
|
3604df |
- permission checking */
|
|
|
3604df |
-#define UP_RENAME 0x00000080 /* this is a rename op -
|
|
|
3604df |
- delete the cache entry */
|
|
|
3604df |
-#define UP_FORGET 0x00000100 /* inode_forget on server side -
|
|
|
3604df |
- invalidate the cache entry */
|
|
|
3604df |
-#define UP_PARENT_TIMES 0x00000200 /* update parent dir times */
|
|
|
3604df |
-
|
|
|
3604df |
-/* for fops - open, read, lk, */
|
|
|
3604df |
-#define UP_UPDATE_CLIENT (UP_ATIME)
|
|
|
3604df |
-
|
|
|
3604df |
-/* for fop - write, truncate */
|
|
|
3604df |
-#define UP_WRITE_FLAGS (UP_SIZE | UP_TIMES)
|
|
|
3604df |
-
|
|
|
3604df |
-/* for fop - setattr */
|
|
|
3604df |
-#define UP_ATTR_FLAGS (UP_SIZE | UP_TIMES | UP_OWN | \
|
|
|
3604df |
- UP_MODE | UP_PERM)
|
|
|
3604df |
-/* for fop - rename */
|
|
|
3604df |
-#define UP_RENAME_FLAGS (UP_RENAME)
|
|
|
3604df |
-
|
|
|
3604df |
-/* to invalidate parent directory entries for fops -rename, unlink,
|
|
|
3604df |
- * rmdir, link */
|
|
|
3604df |
-#define UP_PARENT_DENTRY_FLAGS (UP_PARENT_TIMES)
|
|
|
3604df |
-
|
|
|
3604df |
-/* for fop - unlink, link, rmdir, mkdir */
|
|
|
3604df |
-#define UP_NLINK_FLAGS (UP_NLINK | UP_TIMES)
|
|
|
3604df |
-
|
|
|
3604df |
/* xlator options */
|
|
|
3604df |
gf_boolean_t is_cache_invalidation_enabled(xlator_t *this);
|
|
|
3604df |
int32_t get_cache_invalidation_timeout(xlator_t *this);
|
|
|
3604df |
diff --git a/xlators/features/upcall/src/upcall-internal.c b/xlators/features/upcall/src/upcall-internal.c
|
|
|
3604df |
index 81199eb..f9005df 100644
|
|
|
3604df |
--- a/xlators/features/upcall/src/upcall-internal.c
|
|
|
3604df |
+++ b/xlators/features/upcall/src/upcall-internal.c
|
|
|
3604df |
@@ -31,7 +31,6 @@
|
|
|
3604df |
/*
|
|
|
3604df |
* Check if any of the upcall options are enabled:
|
|
|
3604df |
* - cache_invalidation
|
|
|
3604df |
- * - XXX: lease_lk
|
|
|
3604df |
*/
|
|
|
3604df |
gf_boolean_t
|
|
|
3604df |
is_upcall_enabled(xlator_t *this) {
|
|
|
3604df |
@@ -50,25 +49,6 @@ is_upcall_enabled(xlator_t *this) {
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
/*
|
|
|
3604df |
- * Check if any of cache_invalidation is enabled
|
|
|
3604df |
- */
|
|
|
3604df |
-gf_boolean_t
|
|
|
3604df |
-is_cache_invalidation_enabled(xlator_t *this) {
|
|
|
3604df |
- upcall_private_t *priv = NULL;
|
|
|
3604df |
- gf_boolean_t is_enabled = _gf_false;
|
|
|
3604df |
-
|
|
|
3604df |
- if (this->private) {
|
|
|
3604df |
- priv = (upcall_private_t *)this->private;
|
|
|
3604df |
-
|
|
|
3604df |
- if (priv->cache_invalidation_enabled) {
|
|
|
3604df |
- is_enabled = _gf_true;
|
|
|
3604df |
- }
|
|
|
3604df |
- }
|
|
|
3604df |
-
|
|
|
3604df |
- return is_enabled;
|
|
|
3604df |
-}
|
|
|
3604df |
-
|
|
|
3604df |
-/*
|
|
|
3604df |
* Get the cache_invalidation_timeout
|
|
|
3604df |
*/
|
|
|
3604df |
int32_t
|
|
|
3604df |
@@ -476,7 +456,7 @@ upcall_cache_invalidate (call_frame_t *frame, xlator_t *this, client_t *client,
|
|
|
3604df |
upcall_inode_ctx_t *up_inode_ctx = NULL;
|
|
|
3604df |
gf_boolean_t found = _gf_false;
|
|
|
3604df |
|
|
|
3604df |
- if (!is_cache_invalidation_enabled(this))
|
|
|
3604df |
+ if (!is_upcall_enabled(this))
|
|
|
3604df |
return;
|
|
|
3604df |
|
|
|
3604df |
/* server-side generated fops like quota/marker will not have any
|
|
|
3604df |
diff --git a/xlators/features/upcall/src/upcall.c b/xlators/features/upcall/src/upcall.c
|
|
|
3604df |
index e02b1b1..ce3bd4e 100644
|
|
|
3604df |
--- a/xlators/features/upcall/src/upcall.c
|
|
|
3604df |
+++ b/xlators/features/upcall/src/upcall.c
|
|
|
3604df |
@@ -1579,6 +1579,338 @@ err:
|
|
|
3604df |
|
|
|
3604df |
|
|
|
3604df |
int32_t
|
|
|
3604df |
+up_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
3604df |
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
|
|
|
3604df |
+{
|
|
|
3604df |
+ client_t *client = NULL;
|
|
|
3604df |
+ uint32_t flags = 0;
|
|
|
3604df |
+ upcall_local_t *local = NULL;
|
|
|
3604df |
+
|
|
|
3604df |
+ EXIT_IF_UPCALL_OFF (this, out);
|
|
|
3604df |
+
|
|
|
3604df |
+ client = frame->root->client;
|
|
|
3604df |
+ local = frame->local;
|
|
|
3604df |
+
|
|
|
3604df |
+ if ((op_ret < 0) || !local) {
|
|
|
3604df |
+ goto out;
|
|
|
3604df |
+ }
|
|
|
3604df |
+
|
|
|
3604df |
+ flags = UP_XATTR;
|
|
|
3604df |
+ upcall_cache_invalidate (frame, this, client, local->inode, flags,
|
|
|
3604df |
+ NULL, NULL, NULL);
|
|
|
3604df |
+
|
|
|
3604df |
+out:
|
|
|
3604df |
+ UPCALL_STACK_UNWIND (setxattr, frame, op_ret, op_errno, xdata);
|
|
|
3604df |
+
|
|
|
3604df |
+ return 0;
|
|
|
3604df |
+}
|
|
|
3604df |
+
|
|
|
3604df |
+
|
|
|
3604df |
+int32_t
|
|
|
3604df |
+up_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
|
|
|
3604df |
+ int32_t flags, dict_t *xdata)
|
|
|
3604df |
+{
|
|
|
3604df |
+ int32_t op_errno = -1;
|
|
|
3604df |
+ upcall_local_t *local = NULL;
|
|
|
3604df |
+
|
|
|
3604df |
+ EXIT_IF_UPCALL_OFF (this, out);
|
|
|
3604df |
+
|
|
|
3604df |
+ local = upcall_local_init (frame, this, loc->inode);
|
|
|
3604df |
+ if (!local) {
|
|
|
3604df |
+ op_errno = ENOMEM;
|
|
|
3604df |
+ goto err;
|
|
|
3604df |
+ }
|
|
|
3604df |
+
|
|
|
3604df |
+out:
|
|
|
3604df |
+ STACK_WIND (frame, up_setxattr_cbk, FIRST_CHILD(this),
|
|
|
3604df |
+ FIRST_CHILD(this)->fops->setxattr, loc, dict, flags,
|
|
|
3604df |
+ xdata);
|
|
|
3604df |
+
|
|
|
3604df |
+ return 0;
|
|
|
3604df |
+
|
|
|
3604df |
+err:
|
|
|
3604df |
+ UPCALL_STACK_UNWIND (setxattr, frame, -1, op_errno, NULL);
|
|
|
3604df |
+
|
|
|
3604df |
+ return 0;
|
|
|
3604df |
+}
|
|
|
3604df |
+
|
|
|
3604df |
+
|
|
|
3604df |
+int32_t
|
|
|
3604df |
+up_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
3604df |
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
|
|
|
3604df |
+{
|
|
|
3604df |
+ client_t *client = NULL;
|
|
|
3604df |
+ uint32_t flags = 0;
|
|
|
3604df |
+ upcall_local_t *local = NULL;
|
|
|
3604df |
+
|
|
|
3604df |
+ EXIT_IF_UPCALL_OFF (this, out);
|
|
|
3604df |
+
|
|
|
3604df |
+ client = frame->root->client;
|
|
|
3604df |
+ local = frame->local;
|
|
|
3604df |
+
|
|
|
3604df |
+ if ((op_ret < 0) || !local) {
|
|
|
3604df |
+ goto out;
|
|
|
3604df |
+ }
|
|
|
3604df |
+
|
|
|
3604df |
+ flags = UP_XATTR;
|
|
|
3604df |
+ upcall_cache_invalidate (frame, this, client, local->inode, flags,
|
|
|
3604df |
+ NULL, NULL, NULL);
|
|
|
3604df |
+
|
|
|
3604df |
+out:
|
|
|
3604df |
+ UPCALL_STACK_UNWIND (fsetxattr, frame, op_ret, op_errno, xdata);
|
|
|
3604df |
+
|
|
|
3604df |
+ return 0;
|
|
|
3604df |
+}
|
|
|
3604df |
+
|
|
|
3604df |
+
|
|
|
3604df |
+int32_t
|
|
|
3604df |
+up_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict,
|
|
|
3604df |
+ int32_t flags, dict_t *xdata)
|
|
|
3604df |
+{
|
|
|
3604df |
+ int32_t op_errno = -1;
|
|
|
3604df |
+ upcall_local_t *local = NULL;
|
|
|
3604df |
+
|
|
|
3604df |
+ EXIT_IF_UPCALL_OFF (this, out);
|
|
|
3604df |
+
|
|
|
3604df |
+ local = upcall_local_init (frame, this, fd->inode);
|
|
|
3604df |
+ if (!local) {
|
|
|
3604df |
+ op_errno = ENOMEM;
|
|
|
3604df |
+ goto err;
|
|
|
3604df |
+ }
|
|
|
3604df |
+
|
|
|
3604df |
+out:
|
|
|
3604df |
+ STACK_WIND (frame, up_fsetxattr_cbk,
|
|
|
3604df |
+ FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsetxattr,
|
|
|
3604df |
+ fd, dict, flags, xdata);
|
|
|
3604df |
+
|
|
|
3604df |
+ return 0;
|
|
|
3604df |
+
|
|
|
3604df |
+err:
|
|
|
3604df |
+ UPCALL_STACK_UNWIND (fsetxattr, frame, -1, op_errno, NULL);
|
|
|
3604df |
+
|
|
|
3604df |
+ return 0;
|
|
|
3604df |
+}
|
|
|
3604df |
+
|
|
|
3604df |
+
|
|
|
3604df |
+int32_t
|
|
|
3604df |
+up_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
3604df |
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
|
|
|
3604df |
+{
|
|
|
3604df |
+ client_t *client = NULL;
|
|
|
3604df |
+ uint32_t flags = 0;
|
|
|
3604df |
+ upcall_local_t *local = NULL;
|
|
|
3604df |
+
|
|
|
3604df |
+ EXIT_IF_UPCALL_OFF (this, out);
|
|
|
3604df |
+
|
|
|
3604df |
+ client = frame->root->client;
|
|
|
3604df |
+ local = frame->local;
|
|
|
3604df |
+
|
|
|
3604df |
+ if ((op_ret < 0) || !local) {
|
|
|
3604df |
+ goto out;
|
|
|
3604df |
+ }
|
|
|
3604df |
+ flags = UP_XATTR_RM;
|
|
|
3604df |
+ upcall_cache_invalidate (frame, this, client, local->inode, flags,
|
|
|
3604df |
+ NULL, NULL, NULL);
|
|
|
3604df |
+
|
|
|
3604df |
+out:
|
|
|
3604df |
+ UPCALL_STACK_UNWIND (fremovexattr, frame, op_ret, op_errno,
|
|
|
3604df |
+ xdata);
|
|
|
3604df |
+ return 0;
|
|
|
3604df |
+}
|
|
|
3604df |
+
|
|
|
3604df |
+int32_t
|
|
|
3604df |
+up_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
|
|
|
3604df |
+ const char *name, dict_t *xdata)
|
|
|
3604df |
+{
|
|
|
3604df |
+ int32_t op_errno = -1;
|
|
|
3604df |
+ upcall_local_t *local = NULL;
|
|
|
3604df |
+
|
|
|
3604df |
+ EXIT_IF_UPCALL_OFF (this, out);
|
|
|
3604df |
+
|
|
|
3604df |
+ local = upcall_local_init (frame, this, fd->inode);
|
|
|
3604df |
+ if (!local) {
|
|
|
3604df |
+ op_errno = ENOMEM;
|
|
|
3604df |
+ goto err;
|
|
|
3604df |
+ }
|
|
|
3604df |
+
|
|
|
3604df |
+out:
|
|
|
3604df |
+ STACK_WIND (frame, up_fremovexattr_cbk,
|
|
|
3604df |
+ FIRST_CHILD(this), FIRST_CHILD(this)->fops->fremovexattr,
|
|
|
3604df |
+ fd, name, xdata);
|
|
|
3604df |
+ return 0;
|
|
|
3604df |
+
|
|
|
3604df |
+err:
|
|
|
3604df |
+ UPCALL_STACK_UNWIND (fremovexattr, frame, -1, op_errno, NULL);
|
|
|
3604df |
+
|
|
|
3604df |
+ return 0;
|
|
|
3604df |
+}
|
|
|
3604df |
+
|
|
|
3604df |
+int32_t
|
|
|
3604df |
+up_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
3604df |
+ int32_t op_ret, int32_t op_errno, dict_t *xdata)
|
|
|
3604df |
+{
|
|
|
3604df |
+ client_t *client = NULL;
|
|
|
3604df |
+ uint32_t flags = 0;
|
|
|
3604df |
+ upcall_local_t *local = NULL;
|
|
|
3604df |
+
|
|
|
3604df |
+ EXIT_IF_UPCALL_OFF (this, out);
|
|
|
3604df |
+
|
|
|
3604df |
+ client = frame->root->client;
|
|
|
3604df |
+ local = frame->local;
|
|
|
3604df |
+
|
|
|
3604df |
+ if ((op_ret < 0) || !local) {
|
|
|
3604df |
+ goto out;
|
|
|
3604df |
+ }
|
|
|
3604df |
+ flags = UP_XATTR_RM;
|
|
|
3604df |
+ upcall_cache_invalidate (frame, this, client, local->inode, flags,
|
|
|
3604df |
+ NULL, NULL, NULL);
|
|
|
3604df |
+
|
|
|
3604df |
+out:
|
|
|
3604df |
+ UPCALL_STACK_UNWIND (removexattr, frame, op_ret, op_errno,
|
|
|
3604df |
+ xdata);
|
|
|
3604df |
+ return 0;
|
|
|
3604df |
+}
|
|
|
3604df |
+
|
|
|
3604df |
+int32_t
|
|
|
3604df |
+up_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
|
|
|
3604df |
+ const char *name, dict_t *xdata)
|
|
|
3604df |
+{
|
|
|
3604df |
+ int32_t op_errno = -1;
|
|
|
3604df |
+ upcall_local_t *local = NULL;
|
|
|
3604df |
+
|
|
|
3604df |
+ EXIT_IF_UPCALL_OFF (this, out);
|
|
|
3604df |
+
|
|
|
3604df |
+ local = upcall_local_init (frame, this, loc->inode);
|
|
|
3604df |
+ if (!local) {
|
|
|
3604df |
+ op_errno = ENOMEM;
|
|
|
3604df |
+ goto err;
|
|
|
3604df |
+ }
|
|
|
3604df |
+
|
|
|
3604df |
+out:
|
|
|
3604df |
+ STACK_WIND (frame, up_removexattr_cbk,
|
|
|
3604df |
+ FIRST_CHILD(this), FIRST_CHILD(this)->fops->removexattr,
|
|
|
3604df |
+ loc, name, xdata);
|
|
|
3604df |
+ return 0;
|
|
|
3604df |
+
|
|
|
3604df |
+err:
|
|
|
3604df |
+ UPCALL_STACK_UNWIND (removexattr, frame, -1, op_errno, NULL);
|
|
|
3604df |
+
|
|
|
3604df |
+ return 0;
|
|
|
3604df |
+}
|
|
|
3604df |
+
|
|
|
3604df |
+
|
|
|
3604df |
+int32_t
|
|
|
3604df |
+up_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
3604df |
+ int32_t op_ret, int32_t op_errno, dict_t *dict,
|
|
|
3604df |
+ dict_t *xdata)
|
|
|
3604df |
+{
|
|
|
3604df |
+ client_t *client = NULL;
|
|
|
3604df |
+ uint32_t flags = 0;
|
|
|
3604df |
+ upcall_local_t *local = NULL;
|
|
|
3604df |
+
|
|
|
3604df |
+ EXIT_IF_UPCALL_OFF (this, out);
|
|
|
3604df |
+
|
|
|
3604df |
+ client = frame->root->client;
|
|
|
3604df |
+ local = frame->local;
|
|
|
3604df |
+
|
|
|
3604df |
+ if ((op_ret < 0) || !local) {
|
|
|
3604df |
+ goto out;
|
|
|
3604df |
+ }
|
|
|
3604df |
+
|
|
|
3604df |
+ flags = UP_UPDATE_CLIENT;
|
|
|
3604df |
+ upcall_cache_invalidate (frame, this, client, local->inode, flags,
|
|
|
3604df |
+ NULL, NULL, NULL);
|
|
|
3604df |
+
|
|
|
3604df |
+out:
|
|
|
3604df |
+ UPCALL_STACK_UNWIND (fgetxattr, frame, op_ret, op_errno,
|
|
|
3604df |
+ dict, xdata);
|
|
|
3604df |
+ return 0;
|
|
|
3604df |
+}
|
|
|
3604df |
+
|
|
|
3604df |
+
|
|
|
3604df |
+int32_t
|
|
|
3604df |
+up_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
|
|
|
3604df |
+ const char *name, dict_t *xdata)
|
|
|
3604df |
+{
|
|
|
3604df |
+ int32_t op_errno = -1;
|
|
|
3604df |
+ upcall_local_t *local = NULL;
|
|
|
3604df |
+
|
|
|
3604df |
+ EXIT_IF_UPCALL_OFF (this, out);
|
|
|
3604df |
+
|
|
|
3604df |
+ local = upcall_local_init (frame, this, fd->inode);
|
|
|
3604df |
+ if (!local) {
|
|
|
3604df |
+ op_errno = ENOMEM;
|
|
|
3604df |
+ goto err;
|
|
|
3604df |
+ }
|
|
|
3604df |
+
|
|
|
3604df |
+out:
|
|
|
3604df |
+ STACK_WIND (frame, up_fgetxattr_cbk,
|
|
|
3604df |
+ FIRST_CHILD(this), FIRST_CHILD(this)->fops->fgetxattr,
|
|
|
3604df |
+ fd, name, xdata);
|
|
|
3604df |
+ return 0;
|
|
|
3604df |
+err:
|
|
|
3604df |
+ UPCALL_STACK_UNWIND (fgetxattr, frame, -1, op_errno,
|
|
|
3604df |
+ NULL, NULL);
|
|
|
3604df |
+ return 0;
|
|
|
3604df |
+}
|
|
|
3604df |
+
|
|
|
3604df |
+
|
|
|
3604df |
+int32_t
|
|
|
3604df |
+up_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
3604df |
+ int32_t op_ret, int32_t op_errno, dict_t *dict,
|
|
|
3604df |
+ dict_t *xdata)
|
|
|
3604df |
+{
|
|
|
3604df |
+ client_t *client = NULL;
|
|
|
3604df |
+ uint32_t flags = 0;
|
|
|
3604df |
+ upcall_local_t *local = NULL;
|
|
|
3604df |
+
|
|
|
3604df |
+ EXIT_IF_UPCALL_OFF (this, out);
|
|
|
3604df |
+
|
|
|
3604df |
+ client = frame->root->client;
|
|
|
3604df |
+ local = frame->local;
|
|
|
3604df |
+
|
|
|
3604df |
+ if ((op_ret < 0) || !local) {
|
|
|
3604df |
+ goto out;
|
|
|
3604df |
+ }
|
|
|
3604df |
+
|
|
|
3604df |
+ flags = UP_UPDATE_CLIENT;
|
|
|
3604df |
+ upcall_cache_invalidate (frame, this, client, local->inode, flags,
|
|
|
3604df |
+ NULL, NULL, NULL);
|
|
|
3604df |
+
|
|
|
3604df |
+out:
|
|
|
3604df |
+ UPCALL_STACK_UNWIND (getxattr, frame, op_ret, op_errno,
|
|
|
3604df |
+ dict, xdata);
|
|
|
3604df |
+ return 0;
|
|
|
3604df |
+}
|
|
|
3604df |
+
|
|
|
3604df |
+int32_t
|
|
|
3604df |
+up_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
|
|
|
3604df |
+ const char *name, dict_t *xdata)
|
|
|
3604df |
+{
|
|
|
3604df |
+ int32_t op_errno = -1;
|
|
|
3604df |
+ upcall_local_t *local = NULL;
|
|
|
3604df |
+
|
|
|
3604df |
+ EXIT_IF_UPCALL_OFF (this, out);
|
|
|
3604df |
+
|
|
|
3604df |
+ local = upcall_local_init (frame, this, loc->inode);
|
|
|
3604df |
+ if (!local) {
|
|
|
3604df |
+ op_errno = ENOMEM;
|
|
|
3604df |
+ goto err;
|
|
|
3604df |
+ }
|
|
|
3604df |
+
|
|
|
3604df |
+out:
|
|
|
3604df |
+ STACK_WIND (frame, up_getxattr_cbk,
|
|
|
3604df |
+ FIRST_CHILD(this), FIRST_CHILD(this)->fops->getxattr,
|
|
|
3604df |
+ loc, name, xdata);
|
|
|
3604df |
+ return 0;
|
|
|
3604df |
+err:
|
|
|
3604df |
+ UPCALL_STACK_UNWIND (getxattr, frame, -1, op_errno,
|
|
|
3604df |
+ NULL, NULL);
|
|
|
3604df |
+ return 0;
|
|
|
3604df |
+}
|
|
|
3604df |
+
|
|
|
3604df |
+
|
|
|
3604df |
+int32_t
|
|
|
3604df |
mem_acct_init (xlator_t *this)
|
|
|
3604df |
{
|
|
|
3604df |
int ret = -1;
|
|
|
3604df |
@@ -1842,6 +2174,13 @@ struct xlator_fops fops = {
|
|
|
3604df |
.rmdir = up_rmdir,
|
|
|
3604df |
.rename = up_rename,
|
|
|
3604df |
|
|
|
3604df |
+ .setxattr = up_setxattr,
|
|
|
3604df |
+ .fsetxattr = up_fsetxattr,
|
|
|
3604df |
+ .getxattr = up_getxattr,
|
|
|
3604df |
+ .fgetxattr = up_fgetxattr,
|
|
|
3604df |
+ .fremovexattr = up_fremovexattr,
|
|
|
3604df |
+ .removexattr = up_removexattr,
|
|
|
3604df |
+
|
|
|
3604df |
#ifdef NOT_SUPPORTED
|
|
|
3604df |
/* internal lk fops */
|
|
|
3604df |
.inodelk = up_inodelk,
|
|
|
3604df |
@@ -1856,13 +2195,6 @@ struct xlator_fops fops = {
|
|
|
3604df |
.fsync = up_fsync,
|
|
|
3604df |
.fsyncdir = up_fsyncdir,
|
|
|
3604df |
|
|
|
3604df |
- /* XXX: Handle xattr fops (BZ-1211863) */
|
|
|
3604df |
- .getxattr = up_getxattr,
|
|
|
3604df |
- .fgetxattr = up_fgetxattr,
|
|
|
3604df |
- .fremovexattr = up_fremovexattr,
|
|
|
3604df |
- .removexattr = up_removexattr,
|
|
|
3604df |
- .setxattr = up_setxattr,
|
|
|
3604df |
- .fsetxattr = up_fsetxattr,
|
|
|
3604df |
.xattrop = up_xattrop,
|
|
|
3604df |
.fxattrop = up_fxattrop,
|
|
|
3604df |
#endif
|
|
|
3604df |
diff --git a/xlators/features/upcall/src/upcall.h b/xlators/features/upcall/src/upcall.h
|
|
|
3604df |
index 4d021e0..d53c6a3 100644
|
|
|
3604df |
--- a/xlators/features/upcall/src/upcall.h
|
|
|
3604df |
+++ b/xlators/features/upcall/src/upcall.h
|
|
|
3604df |
@@ -111,7 +111,7 @@ void *upcall_reaper_thread (void *data);
|
|
|
3604df |
int upcall_reaper_thread_init (xlator_t *this);
|
|
|
3604df |
|
|
|
3604df |
/* Xlator options */
|
|
|
3604df |
-gf_boolean_t is_upcall_enabled(xlator_t *this);
|
|
|
3604df |
+gf_boolean_t is_upcall_enabled (xlator_t *this);
|
|
|
3604df |
|
|
|
3604df |
/* Cache invalidation specific */
|
|
|
3604df |
void upcall_cache_invalidate (call_frame_t *frame, xlator_t *this,
|
|
|
3604df |
--
|
|
|
3604df |
1.7.1
|
|
|
3604df |
|