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>
This commit is contained in:
parent
09af313fe6
commit
1a04884411
@ -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 = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user