summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/server/src/server-helpers.c
diff options
context:
space:
mode:
authorShyamsundarR <srangana@redhat.com>2018-03-10 23:08:04 -0500
committerShyamsundarR <srangana@redhat.com>2018-03-10 23:12:48 -0500
commitece3f0f669dd5497f49c6169634b59b307d6e18b (patch)
tree89554ba05bbb38fe6c4ef15d918f4774de759084 /xlators/protocol/server/src/server-helpers.c
parentb966c7790e35de353ae09ee48d4e2f55e0117f7e (diff)
protocol: Fix 4.0 client, parsing older iatt in dict
In a mixed mode cluster involving 4.0 and older 3.x bricks, if clients are newer, then the iatt encoded in the dictionary can be of the older iatt format, which a newer client will map incorrectly to the newer structure. This causes failures in FOPs that depend on this iatt for some functionality (seen in mkdir operations failing as EIO, when DHT hits its internal setxattr call). The fix provided is to convert the iatt in the dict, based on which RPC version is used to communicate with the server. IOW, this is the reverse of change in commit "b966c7790e" Tested using a mixed mode cluster (i.e bricks in 3.12 and 4.0 versions) and a mixed set of clients, 3.12 and 4.0 clients. There is no regression test provided, as this needs a mixed mode cluster to test and validate. Change-Id: I454e54651ca836b9f7c28f45f51d5956106aefa9 BUG: 1554053 Signed-off-by: ShyamsundarR <srangana@redhat.com>
Diffstat (limited to 'xlators/protocol/server/src/server-helpers.c')
-rw-r--r--xlators/protocol/server/src/server-helpers.c42
1 files changed, 5 insertions, 37 deletions
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index 8d6a81fe1e2..84f99ad8945 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -1221,38 +1221,6 @@ 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)
{
@@ -2494,7 +2462,7 @@ 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)) {
+ if (gf_replace_old_iatt_in_dict (this_args_cbk->xdata)) {
rsp_args->op_errno = errno;
rsp_args->op_ret = -1;
goto out;
@@ -2762,7 +2730,7 @@ 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)) {
+ if (gf_replace_old_iatt_in_dict (this_args_cbk->xdata)) {
rsp_args->op_errno = errno;
rsp_args->op_ret = -1;
goto out;
@@ -2806,7 +2774,7 @@ 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)) {
+ if (gf_replace_old_iatt_in_dict (this_args_cbk->xdata)) {
rsp_args->op_errno = errno;
rsp_args->op_ret = -1;
goto out;
@@ -3143,7 +3111,7 @@ 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)) {
+ if (gf_replace_old_iatt_in_dict (this_args_cbk->xdata)) {
rsp_args->op_errno = errno;
rsp_args->op_ret = -1;
goto out;
@@ -3253,7 +3221,7 @@ 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)) {
+ if (gf_replace_old_iatt_in_dict (this_args_cbk->xdata)) {
rsp_args->op_errno = errno;
rsp_args->op_ret = -1;
goto out;