diff options
author | Raghavendra Bhat <raghavendra@redhat.com> | 2014-12-09 23:20:18 +0530 |
---|---|---|
committer | Raghavendra Bhat <raghavendra@redhat.com> | 2015-01-08 01:41:52 -0800 |
commit | 5c1c4edef11ff91a0cfc807d65233e51dd7b8beb (patch) | |
tree | 700ed998efa61f9d32983467b3d5506f732933e2 /xlators/features | |
parent | 89c2cc5ddb21f337fe66629fefe7230facbf9d7e (diff) |
features/snapview-client: handle fsync fop.
Change-Id: Idaf46bd7497266af837789b09a0c62698f56ee4e
BUG: 1175749
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>
Signed-off-by: Sachin Pandit <spandit@redhat.com>
Reviewed-on: http://review.gluster.org/9345
Diffstat (limited to 'xlators/features')
-rw-r--r-- | xlators/features/snapview-client/src/snapview-client.c | 45 |
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 = { |