summaryrefslogtreecommitdiffstats
path: root/xlators/features/arbiter/src/arbiter.c
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2017-08-23 18:18:24 +0200
committerRavishankar N <ravishankar@redhat.com>2017-09-05 14:03:39 +0000
commitb1352d0974328b367afa7360e9523585efb7178d (patch)
tree9748d319e406c62473692f19138637dd6af83475 /xlators/features/arbiter/src/arbiter.c
parentc0406501f0b4295a9917d31574baa2e462a18799 (diff)
arbiter: return ENOSYS for 'non readable' FOPs
AFR marks the arbiter as 'non readable'. This has been introduced with commit 8ab87137 (afr: do not set arbiter as a readable subvol in inode context). arbiter_readv() should not get called anymore, so it could be removed. However, it is a good defensive approach to have all the inode read FOPs that can not be handled by the arbiter to return ENOSYS. Change-Id: I6ea41680832859bd6790dc8d7440ee98d38205fc BUG: 1484722 Signed-off-by: Niels de Vos <ndevos@redhat.com> Signed-off-by: Ravishankar N <ravishankar@redhat.com> Reviewed-on: https://review.gluster.org/18103 Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/features/arbiter/src/arbiter.c')
-rw-r--r--xlators/features/arbiter/src/arbiter.c45
1 files changed, 35 insertions, 10 deletions
diff --git a/xlators/features/arbiter/src/arbiter.c b/xlators/features/arbiter/src/arbiter.c
index 0e555c84274..cf0841653b7 100644
--- a/xlators/features/arbiter/src/arbiter.c
+++ b/xlators/features/arbiter/src/arbiter.c
@@ -89,15 +89,6 @@ arbiter_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
}
int32_t
-arbiter_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
- off_t offset, uint32_t flags, dict_t *xdata)
-{
- STACK_UNWIND_STRICT (readv, frame, -1, ENOTCONN, NULL, 0, NULL, NULL,
- NULL);
- return 0;
-}
-
-int32_t
arbiter_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset,
dict_t *xdata)
{
@@ -270,6 +261,23 @@ unwind:
return 0;
}
+static int32_t
+arbiter_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
+ off_t offset, uint32_t flags, dict_t *xdata)
+{
+ STACK_UNWIND_STRICT (readv, frame, -1, ENOSYS, NULL, 0, NULL, NULL,
+ NULL);
+ return 0;
+}
+
+static int32_t
+arbiter_seek (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
+ gf_seek_what_t what, dict_t *xdata)
+{
+ STACK_UNWIND_STRICT (seek, frame, -1, ENOSYS, 0, xdata);
+ return 0;
+}
+
int32_t
mem_acct_init (xlator_t *this)
{
@@ -328,13 +336,30 @@ fini (xlator_t *this)
struct xlator_fops fops = {
.lookup = arbiter_lookup,
- .readv = arbiter_readv,
+
+ /* Return success for these inode write FOPS without winding it down to
+ * posix; this is needed for AFR write transaction logic to work.*/
.truncate = arbiter_truncate,
.writev = arbiter_writev,
.ftruncate = arbiter_ftruncate,
.fallocate = arbiter_fallocate,
.discard = arbiter_discard,
.zerofill = arbiter_zerofill,
+
+ /* AFR is not expected to wind these inode read FOPS initiated by the
+ * application to the arbiter brick. But in case a bug causes them
+ * to be called, we return ENOSYS. */
+ .readv = arbiter_readv,
+ .seek = arbiter_seek,
+
+ /* The following inode read FOPS initiated by the application are not
+ * wound by AFR either but internal logic like shd, glfsheal and
+ * client side healing in AFR will send them for selfheal/ inode refresh
+ * operations etc.,so we need to wind them down to posix:
+ *
+ * (f)stat, readdir(p), readlink, (f)getxattr.*/
+
+ /* All other FOPs not listed here are safe to be wound down to posix.*/
};
struct xlator_cbks cbks = {