summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
Diffstat (limited to 'xlators')
-rw-r--r--xlators/protocol/server/src/server-helpers.c62
-rw-r--r--xlators/protocol/server/src/server-helpers.h2
-rw-r--r--xlators/protocol/server/src/server-rpc-fops.c30
3 files changed, 94 insertions, 0 deletions
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index 31eb2510cf8..8d6a81fe1e2 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -1221,6 +1221,38 @@ getactivelkinfo_rsp_cleanup_v2 (gfx_getactivelk_rsp *rsp)
}
int
+replace_old_iatt_in_dict (dict_t *xdata)
+{
+ int ret;
+ struct old_iatt *o_iatt; /* old iatt structure */
+ struct iatt *c_iatt; /* current iatt */
+ int32_t len = sizeof(struct old_iatt);
+
+ if (!xdata) {
+ return 0;
+ }
+
+ ret = dict_get_bin (xdata, DHT_IATT_IN_XDATA_KEY, (void **)&c_iatt);
+ if (ret < 0) {
+ return 0;
+ }
+
+ o_iatt = GF_CALLOC (1, len, gf_common_mt_char);
+ if (!o_iatt) {
+ return -1;
+ }
+
+ oldiatt_from_iatt (o_iatt, c_iatt);
+
+ ret = dict_set_bin (xdata, DHT_IATT_IN_XDATA_KEY, o_iatt, len);
+ if (ret) {
+ GF_FREE (o_iatt);
+ }
+
+ return ret;
+}
+
+int
gf_server_check_getxattr_cmd (call_frame_t *frame, const char *key)
{
@@ -2462,6 +2494,12 @@ server_populate_compound_response (xlator_t *this, gfs3_compound_rsp *rsp,
rsp_args = &this_rsp->compound_rsp_u.compound_unlink_rsp;
+ if (replace_old_iatt_in_dict (this_args_cbk->xdata)) {
+ rsp_args->op_errno = errno;
+ rsp_args->op_ret = -1;
+ goto out;
+ }
+
GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
&rsp_args->xdata.xdata_val,
rsp_args->xdata.xdata_len,
@@ -2724,6 +2762,12 @@ server_populate_compound_response (xlator_t *this, gfs3_compound_rsp *rsp,
rsp_args = &this_rsp->compound_rsp_u.compound_setxattr_rsp;
+ if (replace_old_iatt_in_dict (this_args_cbk->xdata)) {
+ rsp_args->op_errno = errno;
+ rsp_args->op_ret = -1;
+ goto out;
+ }
+
GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
&rsp_args->xdata.xdata_val,
rsp_args->xdata.xdata_len,
@@ -2762,6 +2806,12 @@ server_populate_compound_response (xlator_t *this, gfs3_compound_rsp *rsp,
rsp_args = &this_rsp->compound_rsp_u.compound_removexattr_rsp;
+ if (replace_old_iatt_in_dict (this_args_cbk->xdata)) {
+ rsp_args->op_errno = errno;
+ rsp_args->op_ret = -1;
+ goto out;
+ }
+
GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
&rsp_args->xdata.xdata_val,
rsp_args->xdata.xdata_len,
@@ -3093,6 +3143,12 @@ server_populate_compound_response (xlator_t *this, gfs3_compound_rsp *rsp,
rsp_args = &this_rsp->compound_rsp_u.compound_setxattr_rsp;
+ if (replace_old_iatt_in_dict (this_args_cbk->xdata)) {
+ rsp_args->op_errno = errno;
+ rsp_args->op_ret = -1;
+ goto out;
+ }
+
GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
&rsp_args->xdata.xdata_val,
rsp_args->xdata.xdata_len,
@@ -3197,6 +3253,12 @@ server_populate_compound_response (xlator_t *this, gfs3_compound_rsp *rsp,
rsp_args = &this_rsp->compound_rsp_u.compound_fremovexattr_rsp;
+ if (replace_old_iatt_in_dict (this_args_cbk->xdata)) {
+ rsp_args->op_errno = errno;
+ rsp_args->op_ret = -1;
+ goto out;
+ }
+
GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
&rsp_args->xdata.xdata_val,
rsp_args->xdata.xdata_len,
diff --git a/xlators/protocol/server/src/server-helpers.h b/xlators/protocol/server/src/server-helpers.h
index b89105a355f..73e2b89b21f 100644
--- a/xlators/protocol/server/src/server-helpers.h
+++ b/xlators/protocol/server/src/server-helpers.h
@@ -74,6 +74,8 @@ getactivelkinfo_rsp_cleanup (gfs3_getactivelk_rsp *rsp);
int
getactivelkinfo_rsp_cleanup_v2 (gfx_getactivelk_rsp *rsp);
+int replace_old_iatt_in_dict (dict_t *);
+
int
server_populate_compound_response (xlator_t *this, gfs3_compound_rsp *rsp,
call_frame_t *frame,
diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c
index 2c3f71bb245..45cd5b68048 100644
--- a/xlators/protocol/server/src/server-rpc-fops.c
+++ b/xlators/protocol/server/src/server-rpc-fops.c
@@ -724,6 +724,12 @@ server_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
server_state_t *state = NULL;
gf_loglevel_t loglevel = GF_LOG_NONE;
+ if (replace_old_iatt_in_dict (xdata)) {
+ op_errno = errno;
+ op_ret = -1;
+ goto out;
+ }
+
GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
@@ -766,6 +772,12 @@ server_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
rpcsvc_request_t *req = NULL;
server_state_t *state = NULL;
+ if (replace_old_iatt_in_dict (xdata)) {
+ op_errno = errno;
+ op_ret = -1;
+ goto out;
+ }
+
GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
@@ -909,6 +921,12 @@ server_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
rpcsvc_request_t *req = NULL;
server_state_t *state = NULL;
+ if (replace_old_iatt_in_dict (xdata)) {
+ op_errno = errno;
+ op_ret = -1;
+ goto out;
+ }
+
GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
@@ -974,6 +992,12 @@ server_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
rpcsvc_request_t *req = NULL;
server_state_t *state = NULL;
+ if (replace_old_iatt_in_dict (xdata)) {
+ op_errno = errno;
+ op_ret = -1;
+ goto out;
+ }
+
GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);
@@ -1066,6 +1090,12 @@ server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
server_state_t *state = NULL;
rpcsvc_request_t *req = NULL;
+ if (replace_old_iatt_in_dict (xdata)) {
+ op_errno = errno;
+ op_ret = -1;
+ goto out;
+ }
+
GF_PROTOCOL_DICT_SERIALIZE (this, xdata, &rsp.xdata.xdata_val,
rsp.xdata.xdata_len, op_errno, out);