|
|
14f8ab |
From 10e9f850017d58fcd813ccce253784280326f1d0 Mon Sep 17 00:00:00 2001
|
|
|
14f8ab |
From: Anuradha Talur <atalur@commvault.com>
|
|
|
14f8ab |
Date: Tue, 20 Nov 2018 13:15:26 -0800
|
|
|
14f8ab |
Subject: [PATCH 152/169] storage/posix: changes with respect to cloudsync
|
|
|
14f8ab |
|
|
|
14f8ab |
Main changes include logic to update iatt buf
|
|
|
14f8ab |
with file size from extended attributes in posix
|
|
|
14f8ab |
rather than having this logic in cloudsync xlator.
|
|
|
14f8ab |
|
|
|
14f8ab |
backport of:https://review.gluster.org/#/c/glusterfs/+/21694/
|
|
|
14f8ab |
|
|
|
14f8ab |
> Change-Id: I44f5f8df7a01e496372557fe2f4eff368dbdaa33
|
|
|
14f8ab |
> fixes: bz#1642168
|
|
|
14f8ab |
> Signed-off-by: Anuradha Talur <atalur@commvault.com>
|
|
|
14f8ab |
|
|
|
14f8ab |
Change-Id: I34880d856fb3add4ce88d64021d08d95405fc1c1
|
|
|
14f8ab |
Signed-off-by: Susant Palai <spalai@redhat.com>
|
|
|
14f8ab |
Reviewed-on: https://code.engineering.redhat.com/gerrit/172191
|
|
|
14f8ab |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
14f8ab |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
14f8ab |
---
|
|
|
14f8ab |
xlators/storage/posix/src/posix-entry-ops.c | 1 +
|
|
|
14f8ab |
xlators/storage/posix/src/posix-helpers.c | 50 +++++++++
|
|
|
14f8ab |
xlators/storage/posix/src/posix-inode-fd-ops.c | 139 ++++++++++++++++++++++---
|
|
|
14f8ab |
xlators/storage/posix/src/posix.h | 2 +
|
|
|
14f8ab |
4 files changed, 177 insertions(+), 15 deletions(-)
|
|
|
14f8ab |
|
|
|
14f8ab |
diff --git a/xlators/storage/posix/src/posix-entry-ops.c b/xlators/storage/posix/src/posix-entry-ops.c
|
|
|
14f8ab |
index fbd83c4..b24a052 100644
|
|
|
14f8ab |
--- a/xlators/storage/posix/src/posix-entry-ops.c
|
|
|
14f8ab |
+++ b/xlators/storage/posix/src/posix-entry-ops.c
|
|
|
14f8ab |
@@ -272,6 +272,7 @@ posix_lookup(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
|
|
|
14f8ab |
}
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
+ posix_update_iatt_buf(&buf, -1, real_path, xdata);
|
|
|
14f8ab |
if (priv->update_pgfid_nlinks) {
|
|
|
14f8ab |
if (!gf_uuid_is_null(loc->pargfid) && !IA_ISDIR(buf.ia_type)) {
|
|
|
14f8ab |
MAKE_PGFID_XATTR_KEY(pgfid_xattr_key, PGFID_XATTR_KEY_PREFIX,
|
|
|
14f8ab |
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
|
|
|
14f8ab |
index 37e33a9..d0fd45a 100644
|
|
|
14f8ab |
--- a/xlators/storage/posix/src/posix-helpers.c
|
|
|
14f8ab |
+++ b/xlators/storage/posix/src/posix-helpers.c
|
|
|
14f8ab |
@@ -3453,3 +3453,53 @@ posix_check_dev_file(xlator_t *this, inode_t *inode, char *fop, int *op_errno)
|
|
|
14f8ab |
out:
|
|
|
14f8ab |
return ret;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+void
|
|
|
14f8ab |
+posix_update_iatt_buf(struct iatt *buf, int fd, char *loc, dict_t *xattr_req)
|
|
|
14f8ab |
+{
|
|
|
14f8ab |
+ int ret = 0;
|
|
|
14f8ab |
+ char val[4096] = {
|
|
|
14f8ab |
+ 0,
|
|
|
14f8ab |
+ };
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ if (!xattr_req)
|
|
|
14f8ab |
+ return;
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ if (!(dict_getn(xattr_req, GF_CS_OBJECT_STATUS,
|
|
|
14f8ab |
+ strlen(GF_CS_OBJECT_STATUS))))
|
|
|
14f8ab |
+ return;
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ if (fd != -1) {
|
|
|
14f8ab |
+ ret = sys_fgetxattr(fd, GF_CS_OBJECT_SIZE, &val, sizeof(val));
|
|
|
14f8ab |
+ if (ret > 0) {
|
|
|
14f8ab |
+ buf->ia_size = atoll(val);
|
|
|
14f8ab |
+ } else {
|
|
|
14f8ab |
+ /* Safe to assume that the other 2 xattrs are also not set*/
|
|
|
14f8ab |
+ return;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ ret = sys_fgetxattr(fd, GF_CS_BLOCK_SIZE, &val, sizeof(val));
|
|
|
14f8ab |
+ if (ret > 0) {
|
|
|
14f8ab |
+ buf->ia_blksize = atoll(val);
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ ret = sys_fgetxattr(fd, GF_CS_NUM_BLOCKS, &val, sizeof(val));
|
|
|
14f8ab |
+ if (ret > 0) {
|
|
|
14f8ab |
+ buf->ia_blocks = atoll(val);
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ } else {
|
|
|
14f8ab |
+ ret = sys_lgetxattr(loc, GF_CS_OBJECT_SIZE, &val, sizeof(val));
|
|
|
14f8ab |
+ if (ret > 0) {
|
|
|
14f8ab |
+ buf->ia_size = atoll(val);
|
|
|
14f8ab |
+ } else {
|
|
|
14f8ab |
+ /* Safe to assume that the other 2 xattrs are also not set*/
|
|
|
14f8ab |
+ return;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ ret = sys_lgetxattr(loc, GF_CS_BLOCK_SIZE, &val, sizeof(val));
|
|
|
14f8ab |
+ if (ret > 0) {
|
|
|
14f8ab |
+ buf->ia_blksize = atoll(val);
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ ret = sys_lgetxattr(loc, GF_CS_NUM_BLOCKS, &val, sizeof(val));
|
|
|
14f8ab |
+ if (ret > 0) {
|
|
|
14f8ab |
+ buf->ia_blocks = atoll(val);
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+}
|
|
|
14f8ab |
diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c
|
|
|
14f8ab |
index 7dbbd3d..065fced 100644
|
|
|
14f8ab |
--- a/xlators/storage/posix/src/posix-inode-fd-ops.c
|
|
|
14f8ab |
+++ b/xlators/storage/posix/src/posix-inode-fd-ops.c
|
|
|
14f8ab |
@@ -108,6 +108,63 @@ extern char *marker_xattrs[];
|
|
|
14f8ab |
static char *disallow_removexattrs[] = {GF_XATTR_VOL_ID_KEY, GFID_XATTR_KEY,
|
|
|
14f8ab |
NULL};
|
|
|
14f8ab |
|
|
|
14f8ab |
+void
|
|
|
14f8ab |
+posix_cs_build_xattr_rsp(xlator_t *this, dict_t **rsp, dict_t *req, int fd,
|
|
|
14f8ab |
+ char *loc)
|
|
|
14f8ab |
+{
|
|
|
14f8ab |
+ int ret = 0;
|
|
|
14f8ab |
+ uuid_t uuid;
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ if (!(dict_getn(req, GF_CS_OBJECT_STATUS, strlen(GF_CS_OBJECT_STATUS))))
|
|
|
14f8ab |
+ return;
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ if (!(*rsp)) {
|
|
|
14f8ab |
+ *rsp = dict_new();
|
|
|
14f8ab |
+ if (!(*rsp)) {
|
|
|
14f8ab |
+ return;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ if (fd != -1) {
|
|
|
14f8ab |
+ if (dict_getn(req, GF_CS_XATTR_ARCHIVE_UUID,
|
|
|
14f8ab |
+ strlen(GF_CS_XATTR_ARCHIVE_UUID))) {
|
|
|
14f8ab |
+ ret = sys_fgetxattr(fd, GF_CS_XATTR_ARCHIVE_UUID, uuid, 16);
|
|
|
14f8ab |
+ if (ret > 0) {
|
|
|
14f8ab |
+ ret = dict_set_gfuuid(*rsp, GF_CS_XATTR_ARCHIVE_UUID, uuid,
|
|
|
14f8ab |
+ true);
|
|
|
14f8ab |
+ if (ret) {
|
|
|
14f8ab |
+ gf_msg(this->name, GF_LOG_WARNING, 0, P_MSG_DICT_SET_FAILED,
|
|
|
14f8ab |
+ "%s: Failed to set "
|
|
|
14f8ab |
+ "dictionary value for %s for fd %d",
|
|
|
14f8ab |
+ uuid_utoa(uuid), GF_CS_XATTR_ARCHIVE_UUID, fd);
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ } else {
|
|
|
14f8ab |
+ gf_msg_debug(this->name, 0, "getxattr failed on %s for fd %d",
|
|
|
14f8ab |
+ GF_CS_XATTR_ARCHIVE_UUID, fd);
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ } else {
|
|
|
14f8ab |
+ if (dict_getn(req, GF_CS_XATTR_ARCHIVE_UUID,
|
|
|
14f8ab |
+ strlen(GF_CS_XATTR_ARCHIVE_UUID))) {
|
|
|
14f8ab |
+ ret = sys_lgetxattr(loc, GF_CS_XATTR_ARCHIVE_UUID, uuid, 16);
|
|
|
14f8ab |
+ if (ret > 0) {
|
|
|
14f8ab |
+ ret = dict_set_gfuuid(*rsp, GF_CS_XATTR_ARCHIVE_UUID, uuid,
|
|
|
14f8ab |
+ true);
|
|
|
14f8ab |
+ if (ret) {
|
|
|
14f8ab |
+ gf_msg(this->name, GF_LOG_WARNING, 0, P_MSG_DICT_SET_FAILED,
|
|
|
14f8ab |
+ "%s: Failed to set "
|
|
|
14f8ab |
+ "dictionary value for %s for loc %s",
|
|
|
14f8ab |
+ uuid_utoa(uuid), GF_CS_XATTR_ARCHIVE_UUID, loc);
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ } else {
|
|
|
14f8ab |
+ gf_msg_debug(this->name, 0, "getxattr failed on %s for %s",
|
|
|
14f8ab |
+ GF_CS_XATTR_ARCHIVE_UUID, loc);
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+ return;
|
|
|
14f8ab |
+}
|
|
|
14f8ab |
+
|
|
|
14f8ab |
int32_t
|
|
|
14f8ab |
posix_stat(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
|
|
|
14f8ab |
{
|
|
|
14f8ab |
@@ -150,8 +207,11 @@ posix_stat(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
|
|
|
14f8ab |
|
|
|
14f8ab |
posix_cs_maintenance(this, NULL, loc, NULL, &buf, real_path, xdata,
|
|
|
14f8ab |
&xattr_rsp, _gf_true);
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ posix_cs_build_xattr_rsp(this, &xattr_rsp, xdata, -1, real_path);
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
+ posix_update_iatt_buf(&buf, -1, real_path, xdata);
|
|
|
14f8ab |
op_ret = 0;
|
|
|
14f8ab |
|
|
|
14f8ab |
out:
|
|
|
14f8ab |
@@ -422,6 +482,8 @@ posix_setattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
|
|
|
14f8ab |
if (xdata)
|
|
|
14f8ab |
xattr_rsp = posix_xattr_fill(this, real_path, loc, NULL, -1, xdata,
|
|
|
14f8ab |
&statpost);
|
|
|
14f8ab |
+ posix_update_iatt_buf(&statpre, -1, real_path, xdata);
|
|
|
14f8ab |
+ posix_update_iatt_buf(&statpost, -1, real_path, xdata);
|
|
|
14f8ab |
op_ret = 0;
|
|
|
14f8ab |
|
|
|
14f8ab |
out:
|
|
|
14f8ab |
@@ -898,6 +960,7 @@ posix_do_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
|
|
|
14f8ab |
}
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
+ posix_update_iatt_buf(statpre, pfd->fd, NULL, xdata);
|
|
|
14f8ab |
/* See if we can use FALLOC_FL_ZERO_RANGE to perform the zero fill.
|
|
|
14f8ab |
* If it fails, fall back to _posix_do_zerofill() and an optional fsync.
|
|
|
14f8ab |
*/
|
|
|
14f8ab |
@@ -1366,6 +1429,7 @@ posix_truncate(call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset,
|
|
|
14f8ab |
}
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
+ posix_update_iatt_buf(&prebuf, -1, real_path, xdata);
|
|
|
14f8ab |
op_ret = sys_truncate(real_path, offset);
|
|
|
14f8ab |
if (op_ret == -1) {
|
|
|
14f8ab |
op_errno = errno;
|
|
|
14f8ab |
@@ -1405,6 +1469,10 @@ posix_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
|
|
|
14f8ab |
int32_t _fd = -1;
|
|
|
14f8ab |
struct posix_fd *pfd = NULL;
|
|
|
14f8ab |
struct posix_private *priv = NULL;
|
|
|
14f8ab |
+ struct iatt preop = {
|
|
|
14f8ab |
+ 0,
|
|
|
14f8ab |
+ };
|
|
|
14f8ab |
+ dict_t *rsp_xdata = NULL;
|
|
|
14f8ab |
struct iatt stbuf = {
|
|
|
14f8ab |
0,
|
|
|
14f8ab |
};
|
|
|
14f8ab |
@@ -1471,6 +1539,18 @@ posix_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
|
|
|
14f8ab |
pfd->flags = flags;
|
|
|
14f8ab |
pfd->fd = _fd;
|
|
|
14f8ab |
|
|
|
14f8ab |
+ if (xdata) {
|
|
|
14f8ab |
+ op_ret = posix_fdstat(this, fd->inode, pfd->fd, &preop);
|
|
|
14f8ab |
+ if (op_ret == -1) {
|
|
|
14f8ab |
+ gf_msg(this->name, GF_LOG_ERROR, errno, P_MSG_FSTAT_FAILED,
|
|
|
14f8ab |
+ "pre-operation fstat failed on fd=%p", fd);
|
|
|
14f8ab |
+ goto out;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ posix_cs_maintenance(this, fd, NULL, &pfd->fd, &preop, NULL, xdata,
|
|
|
14f8ab |
+ &rsp_xdata, _gf_true);
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+
|
|
|
14f8ab |
op_ret = fd_ctx_set(fd, this, (uint64_t)(long)pfd);
|
|
|
14f8ab |
if (op_ret)
|
|
|
14f8ab |
gf_msg(this->name, GF_LOG_WARNING, 0, P_MSG_FD_PATH_SETTING_FAILED,
|
|
|
14f8ab |
@@ -1488,7 +1568,7 @@ out:
|
|
|
14f8ab |
|
|
|
14f8ab |
SET_TO_OLD_FS_ID();
|
|
|
14f8ab |
|
|
|
14f8ab |
- STACK_UNWIND_STRICT(open, frame, op_ret, op_errno, fd, NULL);
|
|
|
14f8ab |
+ STACK_UNWIND_STRICT(open, frame, op_ret, op_errno, fd, rsp_xdata);
|
|
|
14f8ab |
|
|
|
14f8ab |
return 0;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
@@ -1573,6 +1653,7 @@ posix_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
|
|
|
14f8ab |
}
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
+ posix_update_iatt_buf(&preop, _fd, NULL, xdata);
|
|
|
14f8ab |
op_ret = sys_pread(_fd, iobuf->ptr, size, offset);
|
|
|
14f8ab |
if (op_ret == -1) {
|
|
|
14f8ab |
op_errno = errno;
|
|
|
14f8ab |
@@ -1878,6 +1959,7 @@ posix_writev(call_frame_t *frame, xlator_t *this, fd_t *fd,
|
|
|
14f8ab |
}
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
+ posix_update_iatt_buf(&preop, _fd, NULL, xdata);
|
|
|
14f8ab |
if (locked && write_append) {
|
|
|
14f8ab |
if (preop.ia_size == offset || (fd->flags & O_APPEND))
|
|
|
14f8ab |
is_append = 1;
|
|
|
14f8ab |
@@ -2531,10 +2613,8 @@ posix_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
|
|
|
14f8ab |
0,
|
|
|
14f8ab |
};
|
|
|
14f8ab |
data_t *tdata = NULL;
|
|
|
14f8ab |
- char stime[4096];
|
|
|
14f8ab |
- char sxattr[4096];
|
|
|
14f8ab |
+ char *cs_var = NULL;
|
|
|
14f8ab |
gf_cs_obj_state state = -1;
|
|
|
14f8ab |
- char remotepath[4096] = {0};
|
|
|
14f8ab |
int i = 0;
|
|
|
14f8ab |
int len;
|
|
|
14f8ab |
|
|
|
14f8ab |
@@ -2588,10 +2668,11 @@ posix_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
|
|
|
14f8ab |
goto unlock;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
- sprintf(stime, "%" PRId64, tmp_stbuf.ia_mtime);
|
|
|
14f8ab |
+ cs_var = alloca(4096);
|
|
|
14f8ab |
+ sprintf(cs_var, "%" PRId64, tmp_stbuf.ia_mtime);
|
|
|
14f8ab |
|
|
|
14f8ab |
/*TODO: may be should consider nano-second also */
|
|
|
14f8ab |
- if (strncmp(stime, tdata->data, tdata->len) != 0) {
|
|
|
14f8ab |
+ if (strncmp(cs_var, tdata->data, tdata->len) > 0) {
|
|
|
14f8ab |
gf_msg(this->name, GF_LOG_ERROR, 0, 0,
|
|
|
14f8ab |
"mtime "
|
|
|
14f8ab |
"passed is different from seen by file now."
|
|
|
14f8ab |
@@ -2601,31 +2682,54 @@ posix_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
|
|
|
14f8ab |
goto unlock;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
- len = sprintf(sxattr, "%" PRIu64, tmp_stbuf.ia_size);
|
|
|
14f8ab |
+ len = sprintf(cs_var, "%" PRIu64, tmp_stbuf.ia_size);
|
|
|
14f8ab |
|
|
|
14f8ab |
- ret = sys_lsetxattr(real_path, GF_CS_OBJECT_SIZE, sxattr, len,
|
|
|
14f8ab |
+ ret = sys_lsetxattr(real_path, GF_CS_OBJECT_SIZE, cs_var, len,
|
|
|
14f8ab |
flags);
|
|
|
14f8ab |
if (ret) {
|
|
|
14f8ab |
+ op_errno = errno;
|
|
|
14f8ab |
gf_msg(this->name, GF_LOG_ERROR, 0, 0,
|
|
|
14f8ab |
"setxattr failed. key %s err %d", GF_CS_OBJECT_SIZE,
|
|
|
14f8ab |
ret);
|
|
|
14f8ab |
+ goto unlock;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ len = sprintf(cs_var, "%" PRIu64, tmp_stbuf.ia_blocks);
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ ret = sys_lsetxattr(real_path, GF_CS_NUM_BLOCKS, cs_var, len,
|
|
|
14f8ab |
+ flags);
|
|
|
14f8ab |
+ if (ret) {
|
|
|
14f8ab |
op_errno = errno;
|
|
|
14f8ab |
+ gf_msg(this->name, GF_LOG_ERROR, 0, 0,
|
|
|
14f8ab |
+ "setxattr failed. key %s err %d", GF_CS_NUM_BLOCKS, ret);
|
|
|
14f8ab |
goto unlock;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
+ len = sprintf(cs_var, "%" PRIu32, tmp_stbuf.ia_blksize);
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ ret = sys_lsetxattr(real_path, GF_CS_BLOCK_SIZE, cs_var, len,
|
|
|
14f8ab |
+ flags);
|
|
|
14f8ab |
+ if (ret) {
|
|
|
14f8ab |
+ op_errno = errno;
|
|
|
14f8ab |
+ gf_msg(this->name, GF_LOG_ERROR, 0, 0,
|
|
|
14f8ab |
+ "setxattr failed. key %s err %d", GF_CS_BLOCK_SIZE, ret);
|
|
|
14f8ab |
+ goto unlock;
|
|
|
14f8ab |
+ }
|
|
|
14f8ab |
+
|
|
|
14f8ab |
+ memset(cs_var, 0, 4096);
|
|
|
14f8ab |
if (loc->path[0] == '/') {
|
|
|
14f8ab |
for (i = 1; i < strlen(loc->path); i++) {
|
|
|
14f8ab |
- remotepath[i - 1] = loc->path[i];
|
|
|
14f8ab |
+ cs_var[i - 1] = loc->path[i];
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
- remotepath[i] = '\0';
|
|
|
14f8ab |
- gf_msg_debug(this->name, GF_LOG_ERROR, "remotepath %s",
|
|
|
14f8ab |
- remotepath);
|
|
|
14f8ab |
+ cs_var[i] = '\0';
|
|
|
14f8ab |
+ gf_msg_debug(this->name, GF_LOG_ERROR, "remotepath %s", cs_var);
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
- ret = sys_lsetxattr(real_path, GF_CS_OBJECT_REMOTE, remotepath,
|
|
|
14f8ab |
- strlen(loc->path), flags);
|
|
|
14f8ab |
+ ret = sys_lsetxattr(real_path, GF_CS_OBJECT_REMOTE, cs_var,
|
|
|
14f8ab |
+ strlen(cs_var), flags);
|
|
|
14f8ab |
if (ret) {
|
|
|
14f8ab |
+ op_errno = errno;
|
|
|
14f8ab |
gf_log("POSIX", GF_LOG_ERROR,
|
|
|
14f8ab |
"setxattr failed - %s"
|
|
|
14f8ab |
" %d",
|
|
|
14f8ab |
@@ -2635,13 +2739,14 @@ posix_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
|
|
|
14f8ab |
|
|
|
14f8ab |
ret = sys_truncate(real_path, 0);
|
|
|
14f8ab |
if (ret) {
|
|
|
14f8ab |
+ op_errno = errno;
|
|
|
14f8ab |
gf_log("POSIX", GF_LOG_ERROR,
|
|
|
14f8ab |
"truncate failed - %s"
|
|
|
14f8ab |
" %d",
|
|
|
14f8ab |
GF_CS_OBJECT_SIZE, ret);
|
|
|
14f8ab |
- op_errno = errno;
|
|
|
14f8ab |
ret = sys_lremovexattr(real_path, GF_CS_OBJECT_REMOTE);
|
|
|
14f8ab |
if (ret) {
|
|
|
14f8ab |
+ op_errno = errno;
|
|
|
14f8ab |
gf_log("POSIX", GF_LOG_ERROR,
|
|
|
14f8ab |
"removexattr "
|
|
|
14f8ab |
"failed post processing- %s"
|
|
|
14f8ab |
@@ -2659,6 +2764,7 @@ posix_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
|
|
|
14f8ab |
}
|
|
|
14f8ab |
unlock:
|
|
|
14f8ab |
UNLOCK(&loc->inode->lock);
|
|
|
14f8ab |
+ op_ret = ret;
|
|
|
14f8ab |
goto out;
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
@@ -4927,6 +5033,7 @@ posix_ftruncate(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
|
|
|
14f8ab |
}
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
+ posix_update_iatt_buf(&preop, _fd, NULL, xdata);
|
|
|
14f8ab |
op_ret = sys_ftruncate(_fd, offset);
|
|
|
14f8ab |
|
|
|
14f8ab |
if (op_ret == -1) {
|
|
|
14f8ab |
@@ -5008,8 +5115,10 @@ posix_fstat(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
|
|
|
14f8ab |
gf_msg(this->name, GF_LOG_ERROR, 0, 0,
|
|
|
14f8ab |
"file state check failed, fd %p", fd);
|
|
|
14f8ab |
}
|
|
|
14f8ab |
+ posix_cs_build_xattr_rsp(this, &xattr_rsp, xdata, _fd, NULL);
|
|
|
14f8ab |
}
|
|
|
14f8ab |
|
|
|
14f8ab |
+ posix_update_iatt_buf(&buf, _fd, NULL, xdata);
|
|
|
14f8ab |
op_ret = 0;
|
|
|
14f8ab |
|
|
|
14f8ab |
out:
|
|
|
14f8ab |
diff --git a/xlators/storage/posix/src/posix.h b/xlators/storage/posix/src/posix.h
|
|
|
14f8ab |
index d5ba08c..1da4d01 100644
|
|
|
14f8ab |
--- a/xlators/storage/posix/src/posix.h
|
|
|
14f8ab |
+++ b/xlators/storage/posix/src/posix.h
|
|
|
14f8ab |
@@ -664,4 +664,6 @@ posix_check_dev_file(xlator_t *this, inode_t *inode, char *fop, int *op_errno);
|
|
|
14f8ab |
int
|
|
|
14f8ab |
posix_spawn_ctx_janitor_thread(xlator_t *this);
|
|
|
14f8ab |
|
|
|
14f8ab |
+void
|
|
|
14f8ab |
+posix_update_iatt_buf(struct iatt *buf, int fd, char *loc, dict_t *xdata);
|
|
|
14f8ab |
#endif /* _POSIX_H */
|
|
|
14f8ab |
--
|
|
|
14f8ab |
1.8.3.1
|
|
|
14f8ab |
|