summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2015-12-18 20:35:02 +0100
committerJeff Darcy <jdarcy@redhat.com>2016-02-04 09:28:44 -0800
commitc58f9ce4eefa62ab0ae78d318e443486c4f80a54 (patch)
treee4c4a981bae8109ad434bf462c5c998f782f07c1 /xlators/features
parent5c39f43c13aa652b0db28ca7afea65982bd568cc (diff)
upcall: add seek() FOP
Change-Id: Ic86919d28cf639b561114dc1440c6ea4bc6f7307 BUG: 1220173 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/13005 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/upcall/src/upcall.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/xlators/features/upcall/src/upcall.c b/xlators/features/upcall/src/upcall.c
index 9b724928010..3d0669b305e 100644
--- a/xlators/features/upcall/src/upcall.c
+++ b/xlators/features/upcall/src/upcall.c
@@ -1522,6 +1522,62 @@ err:
return 0;
}
+
+int32_t
+up_seek_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
+ int op_errno, off_t offset, dict_t *xdata)
+{
+ client_t *client = NULL;
+ uint32_t flags = 0;
+ upcall_local_t *local = NULL;
+
+ EXIT_IF_UPCALL_OFF (this, out);
+
+ client = frame->root->client;
+ local = frame->local;
+
+ if ((op_ret < 0) || !local) {
+ goto out;
+ }
+ flags = UP_UPDATE_CLIENT;
+ upcall_cache_invalidate (frame, this, client, local->inode, flags,
+ NULL, NULL, NULL);
+
+out:
+ UPCALL_STACK_UNWIND (seek, frame, op_ret, op_errno, offset, xdata);
+
+ return 0;
+}
+
+
+int32_t
+up_seek (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
+ gf_seek_what_t what, dict_t *xdata)
+{
+ int32_t op_errno = -1;
+ upcall_local_t *local = NULL;
+
+ EXIT_IF_UPCALL_OFF (this, out);
+
+ local = upcall_local_init (frame, this, fd->inode);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto err;
+ }
+
+out:
+ STACK_WIND (frame, up_seek_cbk, FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->seek, fd, offset, what, xdata);
+
+ return 0;
+
+err:
+ UPCALL_STACK_UNWIND (seek, frame, -1, op_errno, 0, NULL);
+
+ return 0;
+}
+
+
int32_t
mem_acct_init (xlator_t *this)
{
@@ -1758,6 +1814,7 @@ struct xlator_fops fops = {
.readlink = up_readlink,
.readv = up_readv,
.lk = up_lk,
+ .seek = up_seek,
/* fops doing write */
.truncate = up_truncate,