summaryrefslogtreecommitdiffstats
path: root/xlators/features/snapview-client/src
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2014-12-09 23:20:18 +0530
committerVijay Bellur <vbellur@redhat.com>2014-12-12 08:45:03 -0800
commit1a048844117fe13af0b1eb70eab07d304a23a358 (patch)
tree0b61cfbb4285140fe934d8f13dd9c848d1f65ac5 /xlators/features/snapview-client/src
parent09af313fe6b49b03501939dd9e46b783ca4b5416 (diff)
features/snapview-client: handle fsync fop
Change-Id: Idaf46bd7497266af837789b09a0c62698f56ee4e BUG: 1172262 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.org/9258 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Sachin Pandit <spandit@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/features/snapview-client/src')
-rw-r--r--xlators/features/snapview-client/src/snapview-client.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/xlators/features/snapview-client/src/snapview-client.c b/xlators/features/snapview-client/src/snapview-client.c
index 2fa3660d38e..ad505633217 100644
--- a/xlators/features/snapview-client/src/snapview-client.c
+++ b/xlators/features/snapview-client/src/snapview-client.c
@@ -2031,6 +2031,50 @@ out:
return 0;
}
+int
+svc_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int datasync,
+ dict_t *xdata)
+{
+ int inode_type = -1;
+ int ret = -1;
+ int op_ret = -1;
+ int op_errno = EINVAL;
+ gf_boolean_t wind = _gf_false;
+
+ GF_VALIDATE_OR_GOTO ("svc", this, out);
+ GF_VALIDATE_OR_GOTO (this->name, frame, out);
+ GF_VALIDATE_OR_GOTO (this->name, fd, out);
+ GF_VALIDATE_OR_GOTO (this->name, fd->inode, out);
+
+ ret = svc_inode_ctx_get (this, fd->inode, &inode_type);
+ if (ret < 0) {
+ gf_log (this->name, GF_LOG_ERROR, "failed to get inode context "
+ "for %s", uuid_utoa (fd->inode->gfid));
+ op_ret = -1;
+ op_errno = EINVAL;
+ goto out;
+ }
+
+ if (inode_type == NORMAL_INODE) {
+ STACK_WIND_TAIL (frame, FIRST_CHILD (this),
+ FIRST_CHILD (this)->fops->fsync, fd, datasync,
+ xdata);
+ } else {
+ op_ret = -1;
+ op_errno = EROFS;
+ goto out;
+ }
+
+ wind = _gf_true;
+
+out:
+ if (!wind)
+ SVC_STACK_UNWIND (fsync, frame, op_ret, op_errno, NULL, NULL,
+ NULL);
+
+ return 0;
+}
+
int32_t
svc_flush (call_frame_t *frame, xlator_t *this,
fd_t *fd, dict_t *xdata)
@@ -2277,6 +2321,7 @@ struct xlator_fops fops = {
.link = svc_link,
.access = svc_access,
.removexattr = svc_removexattr,
+ .fsync = svc_fsync,
};
struct xlator_cbks cbks = {