summaryrefslogtreecommitdiffstats
path: root/xlators/protocol
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2009-10-01 06:58:46 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-01 07:22:42 -0700
commit186a86f342625a9dce53fe537f8237c6099d5c54 (patch)
tree63ee2f3def75293b9f50acf9e49081fb1caad8ae /xlators/protocol
parentdca4b2a23cb55e1e15fb393e7cbfd39b59280c9c (diff)
Global: Introduce setattr and fsetattr fops
Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 146 (Add setattr FOP) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=146
Diffstat (limited to 'xlators/protocol')
-rw-r--r--xlators/protocol/client/src/client-protocol.c581
-rw-r--r--xlators/protocol/server/src/server-protocol.c832
-rw-r--r--xlators/protocol/server/src/server-protocol.h3
3 files changed, 404 insertions, 1012 deletions
diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c
index a09e1ad34e7..43f99770678 100644
--- a/xlators/protocol/client/src/client-protocol.c
+++ b/xlators/protocol/client/src/client-protocol.c
@@ -1327,116 +1327,6 @@ unwind:
return 0;
}
-/**
- * client_chmod - chmod function for client protocol
- * @frame: call frame
- * @this: this translator structure
- * @loc: location
- * @mode:
- *
- * external reference through client_protocol_xlator->fops->chmod
- */
-
-int
-client_chmod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode)
-{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_chmod_req_t *req = NULL;
- size_t hdrlen = -1;
- int ret = -1;
- size_t pathlen = 0;
- ino_t ino = 0;
-
- pathlen = STRLEN_0(loc->path);
-
- ret = inode_ctx_get (loc->inode, this, &ino);
- if (loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "CHMOD %"PRId64" (%s): "
- "failed to get remote inode number",
- loc->inode->ino, loc->path);
- }
-
- hdrlen = gf_hdr_len (req, pathlen);
- hdr = gf_hdr_new (req, pathlen);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
-
- req = gf_param (hdr);
-
- req->ino = hton64 (ino);
- req->mode = hton32 (mode);
- strcpy (req->path, loc->path);
-
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_CHMOD,
- hdr, hdrlen, NULL, 0, NULL);
-
- return ret;
-unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL, NULL);
- return 0;
-
-}
-
-/**
- * client_chown - chown function for client protocol
- * @frame: call frame
- * @this: this translator structure
- * @loc: location
- * @uid: uid of new owner
- * @gid: gid of new owner group
- *
- * external reference through client_protocol_xlator->fops->chown
- */
-
-int
-client_chown (call_frame_t *frame, xlator_t *this, loc_t *loc, uid_t uid,
- gid_t gid)
-{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_chown_req_t *req = NULL;
- size_t hdrlen = -1;
- int ret = -1;
- size_t pathlen = 0;
- ino_t ino = 0;
-
- pathlen = STRLEN_0(loc->path);
-
- ret = inode_ctx_get (loc->inode, this, &ino);
- if (loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "CHOWN %"PRId64" (%s): "
- "failed to get remote inode number",
- loc->inode->ino, loc->path);
- }
-
- hdrlen = gf_hdr_len (req, pathlen);
- hdr = gf_hdr_new (req, pathlen);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
-
- req = gf_param (hdr);
-
- req->ino = hton64 (ino);
- req->uid = hton32 (uid);
- req->gid = hton32 (gid);
- strcpy (req->path, loc->path);
-
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_CHOWN,
- hdr, hdrlen, NULL, 0, NULL);
-
- return ret;
-unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL, NULL);
- return 0;
-
-}
/**
* client_truncate - truncate function for client protocol
@@ -1491,59 +1381,6 @@ unwind:
}
-/**
- * client_utimes - utimes function for client protocol
- * @frame: call frame
- * @this: this translator structure
- * @loc: location
- * @tvp:
- *
- * external reference through client_protocol_xlator->fops->utimes
- */
-
-int
-client_utimens (call_frame_t *frame, xlator_t *this, loc_t *loc,
- struct timespec *tvp)
-{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_utimens_req_t *req = NULL;
- size_t hdrlen = -1;
- int ret = -1;
- size_t pathlen = 0;
- ino_t ino = 0;
-
- pathlen = STRLEN_0(loc->path);
- ret = inode_ctx_get (loc->inode, this, &ino);
- if (loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "UTIMENS %"PRId64" (%s): "
- "failed to get remote inode number",
- loc->inode->ino, loc->path);
- }
-
- hdrlen = gf_hdr_len (req, pathlen);
- hdr = gf_hdr_new (req, pathlen);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
-
- req = gf_param (hdr);
-
- req->ino = hton64 (ino);
- gf_timespec_from_timespec (req->tv, tvp);
- strcpy (req->path, loc->path);
-
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_UTIMENS,
- hdr, hdrlen, NULL, 0, NULL);
-
- return ret;
-unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL, NULL);
- return 0;
-
-}
/**
* client_readv - readv function for client protocol
@@ -3248,115 +3085,6 @@ unwind:
int
-client_fchmod (call_frame_t *frame, xlator_t *this, fd_t *fd, mode_t mode)
-{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_fchmod_req_t *req = NULL;
- int64_t remote_fd = -1;
- size_t hdrlen = -1;
- int ret = -1;
- int32_t op_errno = EINVAL;
- int32_t op_ret = -1;
- client_fd_ctx_t *fdctx = NULL;
- client_conf_t *conf = NULL;
-
- GF_VALIDATE_OR_GOTO (this->name, fd, unwind);
-
- conf = this->private;
-
- pthread_mutex_lock (&conf->mutex);
- {
- fdctx = this_fd_get_ctx (fd, this);
- }
- pthread_mutex_unlock (&conf->mutex);
-
- if (fdctx == NULL) {
- op_errno = EBADFD;
- gf_log (this->name, GF_LOG_DEBUG,
- "(%"PRId64"): failed to get fd ctx. EBADFD",
- fd->inode->ino);
- goto unwind;
- }
- remote_fd = fdctx->remote_fd;
- hdrlen = gf_hdr_len (req, 0);
- hdr = gf_hdr_new (req, 0);
- GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
-
- req = gf_param (hdr);
-
- req->fd = hton64 (remote_fd);
- req->mode = hton32 (mode);
-
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_FCHMOD,
- hdr, hdrlen, NULL, 0, NULL);
-
- return 0;
-
-unwind:
- STACK_UNWIND (frame, op_ret, op_errno, NULL);
- return 0;
-}
-
-
-int
-client_fchown (call_frame_t *frame, xlator_t *this, fd_t *fd, uid_t uid,
- gid_t gid)
-{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_fchown_req_t *req = NULL;
- int64_t remote_fd = 0;
- size_t hdrlen = -1;
- int32_t op_ret = -1;
- int32_t op_errno = EINVAL;
- int32_t ret = -1;
- client_fd_ctx_t *fdctx = NULL;
- client_conf_t *conf = NULL;
-
- GF_VALIDATE_OR_GOTO (this->name, fd, unwind);
-
- conf = this->private;
-
- pthread_mutex_lock (&conf->mutex);
- {
- fdctx = this_fd_get_ctx (fd, this);
- }
- pthread_mutex_unlock (&conf->mutex);
-
- if (fdctx == NULL) {
- op_errno = EBADFD;
- gf_log (this->name, GF_LOG_DEBUG,
- "(%"PRId64"): failed to get fd ctx. EBADFD",
- fd->inode->ino);
- goto unwind;
- }
- remote_fd = fdctx->remote_fd;
- hdrlen = gf_hdr_len (req, 0);
- hdr = gf_hdr_new (req, 0);
- GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
-
- req = gf_param (hdr);
-
- req->fd = hton64 (remote_fd);
- req->uid = hton32 (uid);
- req->gid = hton32 (gid);
-
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_FCHOWN,
- hdr, hdrlen, NULL, 0, NULL);
-
- return 0;
-
-unwind:
- STACK_UNWIND (frame, op_ret, op_errno, NULL);
- return 0;
-
-}
-
-
-int
client_setdents (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags,
dir_entry_t *entries, int32_t count)
{
@@ -3498,6 +3226,102 @@ unwind:
return 0;
}
+int32_t client_setattr (call_frame_t *frame,
+ xlator_t *this,
+ loc_t *loc,
+ struct stat *stbuf,
+ int32_t valid)
+{
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_setattr_req_t *req = NULL;
+ size_t hdrlen = 0;
+ size_t pathlen = 0;
+ ino_t ino = 0;
+ int ret = -1;
+
+ GF_VALIDATE_OR_GOTO ("client", this, unwind);
+ GF_VALIDATE_OR_GOTO (this->name, frame, unwind);
+
+ pathlen = STRLEN_0(loc->path);
+
+ ret = inode_ctx_get (loc->inode, this, &ino);
+ if (loc->inode->ino && ret < 0) {
+ gf_log (this->name, GF_LOG_TRACE,
+ "SETATTR %"PRId64" (%s): "
+ "failed to get remote inode number",
+ loc->inode->ino, loc->path);
+ }
+
+ hdrlen = gf_hdr_len (req, pathlen);
+ hdr = gf_hdr_new (req, pathlen);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
+
+ req = gf_param (hdr);
+
+ req->ino = hton64 (ino);
+ strcpy (req->path, loc->path);
+
+ gf_stat_from_stat (&req->stbuf, stbuf);
+ req->valid = hton32 (valid);
+
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_BULK),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_SETATTR,
+ hdr, hdrlen, NULL, 0, NULL);
+
+ return ret;
+unwind:
+ STACK_UNWIND (frame, -1, EINVAL, NULL);
+ return 0;
+}
+
+int32_t client_fsetattr (call_frame_t *frame,
+ xlator_t *this,
+ fd_t *fd,
+ struct stat *stbuf,
+ int32_t valid)
+{
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_fsetattr_req_t *req = NULL;
+ size_t hdrlen = 0;
+ int ret = -1;
+ client_fd_ctx_t *fdctx = NULL;
+ int64_t remote_fd = -1;
+
+ GF_VALIDATE_OR_GOTO ("client", this, unwind);
+ GF_VALIDATE_OR_GOTO (this->name, frame, unwind);
+
+ fdctx = this_fd_get_ctx (fd, this);
+ if (fdctx == NULL) {
+ gf_log (this->name, GF_LOG_TRACE,
+ "(%"PRId64"): failed to get fd ctx. EBADFD",
+ fd->inode->ino);
+ STACK_UNWIND (frame, -1, EBADFD, NULL, NULL);
+ return 0;
+ }
+
+ remote_fd = fdctx->remote_fd;
+ hdrlen = gf_hdr_len (req, 0);
+ hdr = gf_hdr_new (req, 0);
+ GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+
+ req = gf_param (hdr);
+
+ req->fd = hton64 (remote_fd);
+
+ gf_stat_from_stat (&req->stbuf, stbuf);
+ req->valid = hton32 (valid);
+
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_BULK),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_FSETATTR,
+ hdr, hdrlen, NULL, 0, NULL);
+
+ return ret;
+unwind:
+ STACK_UNWIND (frame, -1, EINVAL, NULL, NULL);
+ return 0;
+}
/**
* client_releasedir - releasedir function for client protocol
@@ -3787,63 +3611,6 @@ fail:
}
/*
- * client_chown_cbk -
- *
- * @frame:
- * @args:
- *
- * not for external reference
- */
-
-int
-client_fchown_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen,
- struct iobuf *iobuf)
-{
- struct stat stbuf = {0, };
- gf_fop_fchown_rsp_t *rsp = NULL;
- int32_t op_ret = 0;
- int32_t op_errno = 0;
-
- rsp = gf_param (hdr);
-
- op_ret = ntoh32 (hdr->rsp.op_ret);
- op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno));
-
- if (op_ret == 0) {
- gf_stat_to_stat (&rsp->stat, &stbuf);
- }
-
- STACK_UNWIND (frame, op_ret, op_errno, &stbuf);
-
- return 0;
-}
-
-
-int
-client_fchmod_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen,
- struct iobuf *iobuf)
-{
- struct stat stbuf = {0, };
- gf_fop_fchmod_rsp_t *rsp = NULL;
- int32_t op_ret = 0;
- int32_t op_errno = 0;
-
- rsp = gf_param (hdr);
-
- op_ret = ntoh32 (hdr->rsp.op_ret);
- op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno));
-
- if (op_ret == 0) {
- gf_stat_to_stat (&rsp->stat, &stbuf);
- }
-
- STACK_UNWIND (frame, op_ret, op_errno, &stbuf);
-
- return 0;
-}
-
-
-/*
* client_create_cbk - create callback function for client protocol
* @frame: call frame
* @args: arguments in dictionary
@@ -4011,98 +3778,6 @@ client_stat_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen,
return 0;
}
-/*
- * client_utimens_cbk - utimens callback for client protocol
- * @frame: call frame
- * @args: argument dictionary
- *
- * not for external reference
- */
-
-int
-client_utimens_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen,
- struct iobuf *iobuf)
-{
- struct stat stbuf = {0, };
- gf_fop_utimens_rsp_t *rsp = NULL;
- int32_t op_ret = 0;
- int32_t op_errno = 0;
-
- rsp = gf_param (hdr);
-
- op_ret = ntoh32 (hdr->rsp.op_ret);
- op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno));
-
- if (op_ret == 0) {
- gf_stat_to_stat (&rsp->stat, &stbuf);
- }
-
- STACK_UNWIND (frame, op_ret, op_errno, &stbuf);
-
- return 0;
-}
-
-/*
- * client_chmod_cbk - chmod for client protocol
- * @frame: call frame
- * @args: argument dictionary
- *
- * not for external reference
- */
-
-int
-client_chmod_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen,
- struct iobuf *iobuf)
-{
- struct stat stbuf = {0, };
- gf_fop_chmod_rsp_t *rsp = NULL;
- int32_t op_ret = 0;
- int32_t op_errno = 0;
-
- rsp = gf_param (hdr);
-
- op_ret = ntoh32 (hdr->rsp.op_ret);
- op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno));
-
- if (op_ret == 0) {
- gf_stat_to_stat (&rsp->stat, &stbuf);
- }
-
- STACK_UNWIND (frame, op_ret, op_errno, &stbuf);
-
- return 0;
-}
-
-/*
- * client_chown_cbk - chown for client protocol
- * @frame: call frame
- * @args: argument dictionary
- *
- * not for external reference
- */
-
-int
-client_chown_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen,
- struct iobuf *iobuf)
-{
- struct stat stbuf = {0, };
- gf_fop_chown_rsp_t *rsp = NULL;
- int32_t op_ret = 0;
- int32_t op_errno = 0;
-
- rsp = gf_param (hdr);
-
- op_ret = ntoh32 (hdr->rsp.op_ret);
- op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno));
-
- if (op_ret == 0) {
- gf_stat_to_stat (&rsp->stat, &stbuf);
- }
-
- STACK_UNWIND (frame, op_ret, op_errno, &stbuf);
-
- return 0;
-}
/*
* client_mknod_cbk - mknod callback for client protocol
@@ -4843,6 +4518,56 @@ fail:
return 0;
}
+static int32_t
+client_setattr_cbk (call_frame_t *frame,gf_hdr_common_t *hdr, size_t hdrlen,
+ struct iobuf *iobuf)
+{
+ struct stat statpre = {0, };
+ struct stat statpost = {0, };
+ gf_fop_setattr_rsp_t *rsp = NULL;
+ int32_t op_ret = 0;
+ int32_t op_errno = 0;
+
+ rsp = gf_param (hdr);
+
+ op_ret = ntoh32 (hdr->rsp.op_ret);
+ op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno));
+
+ if (op_ret == 0) {
+ gf_stat_to_stat (&rsp->statpre, &statpre);
+ gf_stat_to_stat (&rsp->statpost, &statpost);
+ }
+
+ STACK_UNWIND (frame, op_ret, op_errno, &statpre, &statpost);
+
+ return 0;
+}
+
+static int32_t
+client_fsetattr_cbk (call_frame_t *frame,gf_hdr_common_t *hdr, size_t hdrlen,
+ struct iobuf *iobuf)
+{
+ struct stat statpre = {0, };
+ struct stat statpost = {0, };
+ gf_fop_setattr_rsp_t *rsp = NULL;
+ int32_t op_ret = 0;
+ int32_t op_errno = 0;
+
+ rsp = gf_param (hdr);
+
+ op_ret = ntoh32 (hdr->rsp.op_ret);
+ op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno));
+
+ if (op_ret == 0) {
+ gf_stat_to_stat (&rsp->statpre, &statpre);
+ gf_stat_to_stat (&rsp->statpost, &statpost);
+ }
+
+ STACK_UNWIND (frame, op_ret, op_errno, &statpre, &statpost);
+
+ return 0;
+}
+
static dir_entry_t *
gf_bin_to_direntry (char *buf, size_t count)
{
@@ -5935,8 +5660,6 @@ static gf_op_t gf_fops[] = {
[GF_FOP_SYMLINK] = client_symlink_cbk,
[GF_FOP_RENAME] = client_rename_cbk,
[GF_FOP_LINK] = client_link_cbk,
- [GF_FOP_CHMOD] = client_chmod_cbk,
- [GF_FOP_CHOWN] = client_chown_cbk,
[GF_FOP_TRUNCATE] = client_truncate_cbk,
[GF_FOP_OPEN] = client_open_cbk,
[GF_FOP_READ] = client_readv_cbk,
@@ -5955,9 +5678,6 @@ static gf_op_t gf_fops[] = {
[GF_FOP_FTRUNCATE] = client_ftruncate_cbk,
[GF_FOP_FSTAT] = client_fstat_cbk,
[GF_FOP_LK] = client_lk_common_cbk,
- [GF_FOP_UTIMENS] = client_utimens_cbk,
- [GF_FOP_FCHMOD] = client_fchmod_cbk,
- [GF_FOP_FCHOWN] = client_fchown_cbk,
[GF_FOP_LOOKUP] = client_lookup_cbk,
[GF_FOP_SETDENTS] = client_setdents_cbk,
[GF_FOP_READDIR] = client_readdir_cbk,
@@ -5969,6 +5689,8 @@ static gf_op_t gf_fops[] = {
[GF_FOP_RCHECKSUM] = client_rchecksum_cbk,
[GF_FOP_XATTROP] = client_xattrop_cbk,
[GF_FOP_FXATTROP] = client_fxattrop_cbk,
+ [GF_FOP_SETATTR] = client_setattr_cbk,
+ [GF_FOP_FSETATTR] = client_fsetattr_cbk,
};
static gf_op_t gf_mops[] = {
@@ -6573,10 +6295,7 @@ struct xlator_fops fops = {
.symlink = client_symlink,
.rename = client_rename,
.link = client_link,
- .chmod = client_chmod,
- .chown = client_chown,
.truncate = client_truncate,
- .utimens = client_utimens,
.open = client_open,
.readv = client_readv,
.writev = client_writev,
@@ -6601,14 +6320,14 @@ struct xlator_fops fops = {
.entrylk = client_entrylk,
.fentrylk = client_fentrylk,
.lookup = client_lookup,
- .fchmod = client_fchmod,
- .fchown = client_fchown,
.setdents = client_setdents,
.getdents = client_getdents,
.checksum = client_checksum,
.rchecksum = client_rchecksum,
.xattrop = client_xattrop,
.fxattrop = client_fxattrop,
+ .setattr = client_setattr,
+ .fsetattr = client_fsetattr,
};
struct xlator_mops mops = {
diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c
index fe8e83522ed..8e4e9e7251e 100644
--- a/xlators/protocol/server/src/server-protocol.c
+++ b/xlators/protocol/server/src/server-protocol.c
@@ -79,165 +79,6 @@ protocol_server_reply (call_frame_t *frame, int type, int op,
/*
- * server_fchmod_cbk
- */
-int
-server_fchmod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct stat *stbuf)
-{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_fchmod_rsp_t *rsp = NULL;
- size_t hdrlen = 0;
- int32_t gf_errno = 0;
- server_state_t *state = NULL;
-
-
- hdrlen = gf_hdr_len (rsp, 0);
- hdr = gf_hdr_new (rsp, 0);
- rsp = gf_param (hdr);
-
- hdr->rsp.op_ret = hton32 (op_ret);
- gf_errno = gf_errno_to_error (op_errno);
- hdr->rsp.op_errno = hton32 (gf_errno);
-
- if (op_ret == 0) {
- gf_stat_from_stat (&rsp->stat, stbuf);
- } else {
- state = CALL_STATE (frame);
-
- gf_log (this->name, GF_LOG_TRACE,
- "%"PRId64": FCHMOD %"PRId64" (%"PRId64") ==> %"PRId32" (%s)",
- frame->root->unique, state->fd_no,
- state->fd ? state->fd->inode->ino : 0, op_ret,
- strerror (op_errno));
- }
-
- protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_FCHMOD,
- hdr, hdrlen, NULL, 0, NULL);
-
- return 0;
-}
-
-/*
- * server_fchmod
- *
- */
-int
-server_fchmod (call_frame_t *frame, xlator_t *bound_xl,
- gf_hdr_common_t *hdr, size_t hdrlen,
- struct iobuf *iobuf)
-{
- server_connection_t *conn = NULL;
- gf_fop_fchmod_req_t *req = NULL;
- server_state_t *state = NULL;
-
- conn = SERVER_CONNECTION(frame);
-
- req = gf_param (hdr);
- state = CALL_STATE (frame);
- {
- state->fd_no = ntoh64 (req->fd);
- if (state->fd_no >= 0)
- state->fd = gf_fd_fdptr_get (conn->fdtable,
- state->fd_no);
-
- state->mode = ntoh32 (req->mode);
- }
-
- GF_VALIDATE_OR_GOTO(bound_xl->name, state->fd, fail);
-
- STACK_WIND (frame, server_fchmod_cbk,
- BOUND_XL(frame),
- BOUND_XL(frame)->fops->fchmod,
- state->fd, state->mode);
-
- return 0;
-fail:
- server_fchmod_cbk (frame, NULL, frame->this, -1, EINVAL, NULL);
- return 0;
-}
-
-
-/*
- * server_fchown_cbk
- */
-int
-server_fchown_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct stat *stbuf)
-{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_fchown_rsp_t *rsp = NULL;
- size_t hdrlen = 0;
- int32_t gf_errno = 0;
- server_state_t *state = NULL;
-
- hdrlen = gf_hdr_len (rsp, 0);
- hdr = gf_hdr_new (rsp, 0);
- rsp = gf_param (hdr);
-
- hdr->rsp.op_ret = hton32 (op_ret);
- gf_errno = gf_errno_to_error (op_errno);
- hdr->rsp.op_errno = hton32 (gf_errno);
-
- if (op_ret == 0) {
- gf_stat_from_stat (&rsp->stat, stbuf);
- } else {
- state = CALL_STATE(frame);
-
- gf_log (this->name, GF_LOG_TRACE,
- "%"PRId64": FCHOWN %"PRId64" (%"PRId64") ==> %"PRId32" (%s)",
- frame->root->unique, state->fd_no,
- state->fd ? state->fd->inode->ino : 0, op_ret,
- strerror (op_errno));
- }
-
- protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_FCHOWN,
- hdr, hdrlen, NULL, 0, NULL);
-
- return 0;
-}
-
-/*
- * server_fchown
- *
- */
-int
-server_fchown (call_frame_t *frame, xlator_t *bound_xl,
- gf_hdr_common_t *hdr, size_t hdrlen,
- struct iobuf *iobuf)
-{
- server_connection_t *conn = NULL;
- gf_fop_fchown_req_t *req = NULL;
- server_state_t *state = NULL;
-
- conn = SERVER_CONNECTION(frame);
-
- req = gf_param (hdr);
- state = CALL_STATE(frame);
- {
- state->fd_no = ntoh64 (req->fd);
- if (state->fd_no >= 0)
- state->fd = gf_fd_fdptr_get (conn->fdtable,
- state->fd_no);
-
- state->uid = ntoh32 (req->uid);
- state->gid = ntoh32 (req->gid);
- }
-
- GF_VALIDATE_OR_GOTO(bound_xl->name, state->fd, fail);
-
- STACK_WIND (frame, server_fchown_cbk,
- BOUND_XL(frame),
- BOUND_XL(frame)->fops->fchown,
- state->fd, state->uid, state->gid);
-
- return 0;
-fail:
- server_fchown_cbk (frame, NULL, frame->this, -1, EINVAL, NULL);
- return 0;
-}
-
-/*
* server_setdents_cbk - writedir callback for server protocol
* @frame: call frame
* @cookie:
@@ -553,133 +394,6 @@ server_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
/*
- * server_utimens_cbk - utimens callback for server protocol
- * @frame: call frame
- * @cookie:
- * @this:
- * @op_ret:
- * @op_errno:
- * @stbuf:
- *
- * not for external reference
- */
-int
-server_utimens_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct stat *stbuf)
-{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_utimens_rsp_t *rsp = NULL;
- server_state_t *state = NULL;
- size_t hdrlen = 0;
- int32_t gf_errno = 0;
-
-
- state = CALL_STATE(frame);
-
- hdrlen = gf_hdr_len (rsp, 0);
- hdr = gf_hdr_new (rsp, 0);
- rsp = gf_param (hdr);
-
- hdr->rsp.op_ret = hton32 (op_ret);
- gf_errno = gf_errno_to_error (op_errno);
- hdr->rsp.op_errno = hton32 (gf_errno);
-
- if (op_ret == 0)
- gf_stat_from_stat (&rsp->stat, stbuf);
-
- server_loc_wipe (&(state->loc));
-
- protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_UTIMENS,
- hdr, hdrlen, NULL, 0, NULL);
-
- return 0;
-}
-
-/*
- * server_chmod_cbk - chmod callback for server protocol
- * @frame: call frame
- * @cookie:
- * @this:
- * @op_ret:
- * @op_errno:
- * @stbuf:
- *
- * not for external reference
- */
-int
-server_chmod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct stat *stbuf)
-{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_chmod_rsp_t *rsp = NULL;
- server_state_t *state = NULL;
- size_t hdrlen = 0;
- int32_t gf_errno = 0;
-
- state = CALL_STATE(frame);
-
- hdrlen = gf_hdr_len (rsp, 0);
- hdr = gf_hdr_new (rsp, 0);
- rsp = gf_param (hdr);
-
- hdr->rsp.op_ret = hton32 (op_ret);
- gf_errno = gf_errno_to_error (op_errno);
- hdr->rsp.op_errno = hton32 (gf_errno);
-
- if (op_ret == 0)
- gf_stat_from_stat (&rsp->stat, stbuf);
-
- server_loc_wipe (&(state->loc));
-
- protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_CHMOD,
- hdr, hdrlen, NULL, 0, NULL);
-
- return 0;
-}
-
-/*
- * server_chown_cbk - chown callback for server protocol
- * @frame: call frame
- * @cookie:
- * @this:
- * @op_ret:
- * @op_errno:
- * @stbuf:
- *
- * not for external reference
- */
-int
-server_chown_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct stat *stbuf)
-{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_chown_rsp_t *rsp = NULL;
- server_state_t *state = NULL;
- int32_t gf_errno = 0;
- size_t hdrlen = 0;
-
- state = CALL_STATE(frame);
-
- hdrlen = gf_hdr_len (rsp, 0);
- hdr = gf_hdr_new (rsp, 0);
- rsp = gf_param (hdr);
-
- hdr->rsp.op_ret = hton32 (op_ret);
- gf_errno = gf_errno_to_error (op_errno);
- hdr->rsp.op_errno = hton32 (gf_errno);
-
- if (op_ret == 0)
- gf_stat_from_stat (&rsp->stat, stbuf);
-
- server_loc_wipe (&(state->loc));
-
- protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_CHOWN,
- hdr, hdrlen, NULL, 0, NULL);
-
- return 0;
-}
-
-/*
* server_rmdir_cbk - rmdir callback for server protocol
* @frame: call frame
* @cookie:
@@ -2223,6 +1937,117 @@ server_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
return 0;
}
+/*
+ * server_setattr_cbk - setattr callback for server protocol
+ * @frame: call frame
+ * @cookie:
+ * @this:
+ * @op_ret:
+ * @op_errno:
+ * @stbuf:
+ *
+ * not for external reference
+ */
+int
+server_setattr_cbk (call_frame_t *frame,
+ void *cookie,
+ xlator_t *this,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct stat *statpre,
+ struct stat *statpost)
+{
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_setattr_rsp_t *rsp = NULL;
+ server_state_t *state = NULL;
+ size_t hdrlen = 0;
+ int32_t gf_errno = 0;
+
+ state = CALL_STATE (frame);
+
+ hdrlen = gf_hdr_len (rsp, 0);
+ hdr = gf_hdr_new (rsp, 0);
+ rsp = gf_param (hdr);
+
+ hdr->rsp.op_ret = hton32 (op_ret);
+ gf_errno = gf_errno_to_error (op_errno);
+ hdr->rsp.op_errno = hton32 (gf_errno_to_error (op_errno));
+
+ if (op_ret == 0) {
+ gf_stat_from_stat (&rsp->statpre, statpre);
+ gf_stat_from_stat (&rsp->statpost, statpost);
+ } else {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "%"PRId64": SETATTR %s (%"PRId64") ==> %"PRId32" (%s)",
+ frame->root->unique, state->loc.path,
+ state->loc.inode ? state->loc.inode->ino : 0,
+ op_ret, strerror (op_errno));
+ }
+
+ server_loc_wipe (&(state->loc));
+
+ protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_SETATTR,
+ hdr, hdrlen, NULL, 0, NULL);
+
+ return 0;
+}
+
+/*
+ * server_setattr_cbk - setattr callback for server protocol
+ * @frame: call frame
+ * @cookie:
+ * @this:
+ * @op_ret:
+ * @op_errno:
+ * @stbuf:
+ *
+ * not for external reference
+ */
+int
+server_fsetattr_cbk (call_frame_t *frame,
+ void *cookie,
+ xlator_t *this,
+ int32_t op_ret,
+ int32_t op_errno,
+ struct stat *statpre,
+ struct stat *statpost)
+{
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_fsetattr_rsp_t *rsp = NULL;
+ server_state_t *state = NULL;
+ size_t hdrlen = 0;
+ int32_t gf_errno = 0;
+
+ state = CALL_STATE (frame);
+
+ hdrlen = gf_hdr_len (rsp, 0);
+ hdr = gf_hdr_new (rsp, 0);
+ rsp = gf_param (hdr);
+
+ hdr->rsp.op_ret = hton32 (op_ret);
+ gf_errno = gf_errno_to_error (op_errno);
+ hdr->rsp.op_errno = hton32 (gf_errno_to_error (op_errno));
+
+ if (op_ret == 0) {
+ gf_stat_from_stat (&rsp->statpre, statpre);
+ gf_stat_from_stat (&rsp->statpost, statpost);
+ } else {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "%"PRId64": FSETATTR %"PRId64" (%"PRId64") ==> "
+ "%"PRId32" (%s)",
+ frame->root->unique, state->fd_no,
+ state->fd ? state->fd->inode->ino : 0,
+ op_ret, strerror (op_errno));
+ }
+
+ server_loc_wipe (&(state->loc));
+
+ protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_FSETATTR,
+ hdr, hdrlen, NULL, 0, NULL);
+
+ return 0;
+}
+
/*
* server_lookup_cbk - lookup callback for server protocol
@@ -2779,62 +2604,6 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno,
break;
}
- case GF_FOP_CHMOD:
- {
- if (op_ret < 0) {
- gf_log (stub->frame->this->name, GF_LOG_DEBUG,
- "%"PRId64": CHMOD (%s) on %s returning error: "
- "%"PRId32" (%"PRId32")",
- stub->frame->root->unique,
- stub->args.chmod.loc.path,
- BOUND_XL(stub->frame)->name,
- op_ret, op_errno);
- server_chmod_cbk (stub->frame, NULL, stub->frame->this,
- -1, ENOENT, NULL);
- server_loc_wipe (&stub->args.chmod.loc);
- FREE (stub);
- return 0;
- }
-
- if (stub->args.chmod.loc.parent == NULL)
- stub->args.chmod.loc.parent = inode_ref (parent);
-
- if (server_inode && (stub->args.chmod.loc.inode == NULL)) {
- stub->args.chmod.loc.inode = inode_ref (server_inode);
- stub->args.chmod.loc.ino = server_inode->ino;
- }
- call_resume (stub);
- break;
- }
-
- case GF_FOP_CHOWN:
- {
- if (op_ret < 0) {
- gf_log (stub->frame->this->name, GF_LOG_DEBUG,
- "%"PRId64": CHOWN (%s) on %s returning ENOENT: "
- "%"PRId32" (%"PRId32")",
- stub->frame->root->unique,
- stub->args.chown.loc.path,
- BOUND_XL(stub->frame)->name,
- op_ret, op_errno);
- server_chown_cbk (stub->frame, NULL, stub->frame->this,
- -1, ENOENT, NULL);
- server_loc_wipe (&stub->args.chown.loc);
- FREE (stub);
- return 0;
- }
-
- if (stub->args.chown.loc.parent == NULL)
- stub->args.chown.loc.parent = inode_ref (parent);
-
- if (server_inode && (stub->args.chown.loc.inode == NULL)) {
- stub->args.chown.loc.inode = inode_ref (server_inode);
- stub->args.chown.loc.ino = server_inode->ino;
- }
- call_resume (stub);
- break;
- }
-
case GF_FOP_LINK:
{
if ((stub->args.link.oldloc.inode == NULL)
@@ -3136,38 +2905,6 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno,
break;
}
-
- case GF_FOP_UTIMENS:
- {
- if (op_ret < 0) {
- gf_log (stub->frame->this->name, GF_LOG_DEBUG,
- "%"PRId64": UTIMENS (%s) on %s returning error: "
- "%"PRId32" (%"PRId32")",
- stub->frame->root->unique,
- stub->args.utimens.loc.path,
- BOUND_XL(stub->frame)->name,
- op_ret, op_errno);
-
- server_utimens_cbk (stub->frame, NULL,
- stub->frame->this, -1, ENOENT,
- NULL);
- server_loc_wipe (&stub->args.utimens.loc);
- FREE (stub);
- return 0;
- }
-
- if (stub->args.utimens.loc.parent == NULL)
- stub->args.utimens.loc.parent = inode_ref (parent);
-
- if (server_inode && (stub->args.utimens.loc.inode == NULL)) {
- stub->args.utimens.loc.inode =
- inode_ref (server_inode);
- stub->args.utimens.loc.ino = server_inode->ino;
- }
- call_resume (stub);
- break;
- }
-
case GF_FOP_READLINK:
{
if (op_ret < 0) {
@@ -3350,6 +3087,34 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno,
call_resume (stub);
break;
}
+ case GF_FOP_SETATTR:
+ {
+ if (op_ret < 0) {
+ gf_log (stub->frame->this->name, GF_LOG_DEBUG,
+ "%"PRId64": SETATTR (%s) on %s returning error:"
+ " %"PRId32" (%"PRId32")",
+ stub->frame->root->unique,
+ stub->args.setattr.loc.path,
+ BOUND_XL(stub->frame)->name,
+ op_ret, op_errno);
+ server_setattr_cbk (stub->frame, NULL,
+ stub->frame->this,
+ -1, ENOENT, NULL, NULL);
+ server_loc_wipe (&stub->args.setattr.loc);
+ FREE (stub);
+ return 0;
+ }
+
+ if (stub->args.setattr.loc.parent == NULL)
+ stub->args.setattr.loc.parent = inode_ref (parent);
+
+ if (server_inode && (stub->args.setattr.loc.inode == NULL)) {
+ stub->args.setattr.loc.inode = inode_ref (server_inode);
+ stub->args.setattr.loc.ino = server_inode->ino;
+ }
+ call_resume (stub);
+ break;
+ }
default:
call_resume (stub);
}
@@ -3576,6 +3341,119 @@ fail:
return 0;
}
+int
+server_setattr_resume (call_frame_t *frame,
+ xlator_t *this,
+ loc_t *loc,
+ struct stat *stbuf,
+ int32_t valid)
+{
+ server_state_t *state = NULL;
+
+ state = CALL_STATE(frame);
+
+ gf_log (BOUND_XL(frame)->name, GF_LOG_TRACE,
+ "%"PRId64": SETATTR \'%s (%"PRId64")\'",
+ frame->root->unique, state->loc.path, state->loc.ino);
+
+ STACK_WIND (frame, server_setattr_cbk,
+ BOUND_XL(frame),
+ BOUND_XL(frame)->fops->setattr,
+ loc,
+ stbuf, valid);
+ return 0;
+}
+
+/*
+ * server_setattr - setattr function for server
+ * @frame: call frame
+ * @bound_xl: translator this server is bound to
+ * @params: parameters dictionary
+ *
+ * not for external reference
+ */
+int
+server_setattr (call_frame_t *frame, xlator_t *bound_xl,
+ gf_hdr_common_t *hdr, size_t hdrlen,
+ struct iobuf *iobuf)
+{
+ call_stub_t *setattr_stub = NULL;
+ gf_fop_setattr_req_t *req = NULL;
+ server_state_t *state = NULL;
+ int32_t ret = -1;
+ size_t pathlen = 0;
+ struct stat stbuf = {0,};
+ int32_t valid = 0;
+
+ req = gf_param (hdr);
+
+ state = CALL_STATE(frame);
+
+ state->ino = ntoh64 (req->ino);
+ state->path = req->path;
+ pathlen = STRLEN_0(state->path);
+
+ gf_stat_to_stat (&req->stbuf, &stbuf);
+
+ valid = ntoh32 (req->valid);
+
+ ret = server_loc_fill (&(state->loc), state, state->ino, state->par,
+ state->bname, state->path);
+
+ setattr_stub = fop_setattr_stub (frame, server_setattr_resume,
+ &(state->loc), &stbuf, valid);
+ GF_VALIDATE_OR_GOTO(bound_xl->name, setattr_stub, fail);
+
+ if (((state->loc.parent == NULL) && IS_NOT_ROOT(pathlen)) ||
+ (state->loc.inode == NULL)) {
+ do_path_lookup (setattr_stub, &(state->loc));
+ } else {
+ call_resume (setattr_stub);
+ }
+ return 0;
+fail:
+ server_setattr_cbk (frame, NULL, frame->this, -1, EINVAL, NULL, NULL);
+ return 0;
+}
+
+int
+server_fsetattr (call_frame_t *frame, xlator_t *bound_xl,
+ gf_hdr_common_t *hdr, size_t hdrlen,
+ struct iobuf *iobuf)
+{
+ server_connection_t *conn = NULL;
+ gf_fop_fsetattr_req_t *req = NULL;
+ server_state_t *state = NULL;
+ struct stat stbuf = {0,};
+ int32_t valid = 0;
+
+ conn = SERVER_CONNECTION(frame);
+
+ req = gf_param (hdr);
+ state = CALL_STATE (frame);
+ {
+ state->fd_no = ntoh64 (req->fd);
+ if (state->fd_no >= 0)
+ state->fd = gf_fd_fdptr_get (conn->fdtable,
+ state->fd_no);
+
+ gf_stat_to_stat (&req->stbuf, &stbuf);
+
+ valid = ntoh32 (req->valid);
+ }
+
+ GF_VALIDATE_OR_GOTO(bound_xl->name, state->fd, fail);
+
+ STACK_WIND (frame, server_fsetattr_cbk,
+ BOUND_XL(frame),
+ BOUND_XL(frame)->fops->fsetattr,
+ state->fd, &stbuf, valid);
+
+ return 0;
+fail:
+ server_fsetattr_cbk (frame, NULL, frame->this, -1, EINVAL, NULL, NULL);
+ return 0;
+}
int
server_readlink_resume (call_frame_t *frame, xlator_t *this, loc_t *loc,
@@ -5351,205 +5229,6 @@ server_rmdir (call_frame_t *frame, xlator_t *bound_xl,
int
-server_chown_resume (call_frame_t *frame, xlator_t *this, loc_t *loc,
- uid_t uid, gid_t gid)
-{
- server_state_t *state = NULL;
-
- state = CALL_STATE (frame);
-
- gf_log (BOUND_XL(frame)->name, GF_LOG_TRACE,
- "%"PRId64": CHOWN \'%s (%"PRId64")\'",
- frame->root->unique, state->path, state->ino);
-
- STACK_WIND (frame, server_chown_cbk,
- BOUND_XL(frame),
- BOUND_XL(frame)->fops->chown,
- loc, uid, gid);
- return 0;
-}
-
-
-/*
- * server_chown - chown function for server protocol
- * @frame: call frame
- * @bound_xl:
- * @params: parameter dictionary
- *
- * not for external reference
- */
-int
-server_chown (call_frame_t *frame, xlator_t *bound_xl,
- gf_hdr_common_t *hdr, size_t hdrlen,
- struct iobuf *iobuf)
-{
- call_stub_t *chown_stub = NULL;
- gf_fop_chown_req_t *req = NULL;
- server_state_t *state = NULL;
- int32_t ret = -1;
- size_t pathlen = 0;
-
- req = gf_param (hdr);
- state = CALL_STATE(frame);
- {
- state->ino = ntoh64 (req->ino);
- state->path = req->path;
- pathlen = STRLEN_0(state->path);
- state->uid = ntoh32 (req->uid);
- state->gid = ntoh32 (req->gid);
- }
-
- ret = server_loc_fill (&(state->loc), state, state->ino, 0, NULL,
- state->path);
-
- chown_stub = fop_chown_stub (frame, server_chown_resume,
- &(state->loc), state->uid, state->gid);
-
- if (((state->loc.parent == NULL) && IS_NOT_ROOT(pathlen)) ||
- (state->loc.inode == NULL)) {
- do_path_lookup (chown_stub, &(state->loc));
- } else {
- call_resume (chown_stub);
- }
-
- return 0;
-}
-
-
-int
-server_chmod_resume (call_frame_t *frame, xlator_t *this, loc_t *loc,
- mode_t mode)
-{
- server_state_t *state = NULL;
-
- state = CALL_STATE(frame);
-
- gf_log (BOUND_XL(frame)->name, GF_LOG_TRACE,
- "%"PRId64": CHMOD \'%s (%"PRId64")\'",
- frame->root->unique, state->path, state->ino);
-
- STACK_WIND (frame, server_chmod_cbk,
- BOUND_XL(frame),
- BOUND_XL(frame)->fops->chmod,
- loc, mode);
- return 0;
-
-}
-
-/*
- * server_chmod - chmod function for server protocol
- * @frame: call frame
- * @bound_xl:
- * @params: parameter dictionary
- *
- * not for external reference
- */
-int
-server_chmod (call_frame_t *frame, xlator_t *bound_xl,
- gf_hdr_common_t *hdr, size_t hdrlen,
- struct iobuf *iobuf)
-{
- call_stub_t *chmod_stub = NULL;
- gf_fop_chmod_req_t *req = NULL;
- server_state_t *state = NULL;
- int32_t ret = -1;
- size_t pathlen = 0;
-
- req = gf_param (hdr);
-
- state = CALL_STATE(frame);
- {
- state->ino = ntoh64 (req->ino);
- state->path = req->path;
- pathlen = STRLEN_0(state->path);
-
- state->mode = ntoh32 (req->mode);
- }
-
- ret = server_loc_fill (&(state->loc), state, state->ino, 0, NULL,
- state->path);
-
- chmod_stub = fop_chmod_stub (frame, server_chmod_resume,
- &(state->loc), state->mode);
-
- if (((state->loc.parent == NULL) && IS_NOT_ROOT(pathlen)) ||
- (state->loc.inode == NULL)) {
- do_path_lookup (chmod_stub, &(state->loc));
- } else {
- call_resume (chmod_stub);
- }
-
- return 0;
-}
-
-
-int
-server_utimens_resume (call_frame_t *frame, xlator_t *this, loc_t *loc,
- struct timespec *tv)
-{
- server_state_t *state = NULL;
-
- state = CALL_STATE(frame);
-
- gf_log (BOUND_XL(frame)->name, GF_LOG_TRACE,
- "%"PRId64": UTIMENS \'%s (%"PRId64")\'",
- frame->root->unique, state->path, state->ino);
-
- STACK_WIND (frame, server_utimens_cbk,
- BOUND_XL(frame),
- BOUND_XL(frame)->fops->utimens,
- loc, tv);
- return 0;
-}
-
-/*
- * server_utimens - utimens function for server protocol
- * @frame: call frame
- * @bound_xl:
- * @params: parameter dictionary
- *
- * not for external reference
- */
-int
-server_utimens (call_frame_t *frame, xlator_t *bound_xl,
- gf_hdr_common_t *hdr, size_t hdrlen,
- struct iobuf *iobuf)
-{
- call_stub_t *utimens_stub = NULL;
- gf_fop_utimens_req_t *req = NULL;
- server_state_t *state = NULL;
- int32_t ret = -1;
- size_t pathlen = 0;
-
- req = gf_param (hdr);
- state = CALL_STATE(frame);
- {
- state->ino = ntoh64 (req->ino);
- state->path = req->path;
- pathlen = STRLEN_0(state->path);
-
- gf_timespec_to_timespec (req->tv, state->tv);
- }
-
-
- ret = server_loc_fill (&(state->loc), state, state->ino, 0, NULL,
- state->path);
-
- utimens_stub = fop_utimens_stub (frame, server_utimens_resume,
- &(state->loc), state->tv);
-
- if (((state->loc.parent == NULL) && IS_NOT_ROOT(pathlen)) ||
- (state->loc.inode == NULL)) {
- do_path_lookup (utimens_stub, &(state->loc));
- } else {
- call_resume (utimens_stub);
- }
-
- return 0;
-}
-
-
-int
server_inodelk_resume (call_frame_t *frame, xlator_t *this,
const char *volume, loc_t *loc, int32_t cmd,
struct flock *flock)
@@ -7442,8 +7121,6 @@ static gf_op_t gf_fops[] = {
[GF_FOP_SYMLINK] = server_symlink,
[GF_FOP_RENAME] = server_rename,
[GF_FOP_LINK] = server_link,
- [GF_FOP_CHMOD] = server_chmod,
- [GF_FOP_CHOWN] = server_chown,
[GF_FOP_TRUNCATE] = server_truncate,
[GF_FOP_OPEN] = server_open,
[GF_FOP_READ] = server_readv,
@@ -7464,9 +7141,6 @@ static gf_op_t gf_fops[] = {
[GF_FOP_FTRUNCATE] = server_ftruncate,
[GF_FOP_FSTAT] = server_fstat,
[GF_FOP_LK] = server_lk,
- [GF_FOP_UTIMENS] = server_utimens,
- [GF_FOP_FCHMOD] = server_fchmod,
- [GF_FOP_FCHOWN] = server_fchown,
[GF_FOP_LOOKUP] = server_lookup,
[GF_FOP_SETDENTS] = server_setdents,
[GF_FOP_READDIR] = server_readdir,
@@ -7478,6 +7152,8 @@ static gf_op_t gf_fops[] = {
[GF_FOP_RCHECKSUM] = server_rchecksum,
[GF_FOP_XATTROP] = server_xattrop,
[GF_FOP_FXATTROP] = server_fxattrop,
+ [GF_FOP_SETATTR] = server_setattr,
+ [GF_FOP_FSETATTR] = server_fsetattr,
};
diff --git a/xlators/protocol/server/src/server-protocol.h b/xlators/protocol/server/src/server-protocol.h
index dabe6927b85..2f88b63464b 100644
--- a/xlators/protocol/server/src/server-protocol.h
+++ b/xlators/protocol/server/src/server-protocol.h
@@ -121,8 +121,6 @@ struct _server_state {
off_t offset;
mode_t mode;
dev_t dev;
- uid_t uid;
- gid_t gid;
size_t nr_count;
int cmd;
int type;
@@ -142,7 +140,6 @@ struct _server_state {
char is_revalidate;
dict_t *xattr_req;
struct flock flock;
- struct timespec tv[2];
char *resolved;
const char *volume;
};