summaryrefslogtreecommitdiffstats
path: root/xlators/protocol
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2015-07-14 16:16:00 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-07-22 23:46:16 -0700
commit960b99577bbef18add4087599faffa43f09c1dd6 (patch)
tree77c4e8ad401bee70c8f852fe0ecb9efbefe403b9 /xlators/protocol
parent64344ba16ad996d5bf517c2ca983cc730e1c7117 (diff)
protocol/server: use different dict for resolving
Backport of http://review.gluster.org/11661 protocol/server has to resolve the inode before continuing with any fop coming from the clients. For resolving it, server xlator was using the same dict associated with the fop. It causes problems in some situations. If a directory's inode was forgotten because of lru limit being exceeded, then when a create fop comes for an entry within that directory, server tries to resolve it. But since the parent directory's inode is not found in the inode table, it tries to do a hard resolve by doing a lookup on the parent gfid. If any xlator below server wants to get some extended attributes whenever lookup comes, then they set the new keys in the same dict that came along with the create fop. Now, the lookup of the parent succeeds and the create fop proceeds with the same dict (with extra keys present). posix xlaror creates those xattrs that are present in the dict. Thus the xattrs which were not to be present by default are also set as part of create. (Ex: bit-rot related xattrs such as bad-file, version and sign xattrs) Change-Id: I62b0b012b0af3c92df6fced61f87dd0b6b015d4c BUG: 1244100 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.org/11703 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/protocol')
-rw-r--r--xlators/protocol/server/src/server-resolve.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/xlators/protocol/server/src/server-resolve.c b/xlators/protocol/server/src/server-resolve.c
index a7da519488d..906dc00acf5 100644
--- a/xlators/protocol/server/src/server-resolve.c
+++ b/xlators/protocol/server/src/server-resolve.c
@@ -106,6 +106,7 @@ resolve_gfid_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
server_resolve_t *resolve = NULL;
inode_t *link_inode = NULL;
loc_t *resolve_loc = NULL;
+ dict_t *dict = NULL;
state = CALL_STATE (frame);
resolve = state->resolve_now;
@@ -166,10 +167,19 @@ resolve_gfid_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
inode_path (resolve_loc->parent, resolve_loc->name,
(char **) &resolve_loc->path);
+ dict = dict_copy_with_ref (state->xdata, NULL);
+ if (!dict && state->xdata)
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM, PS_MSG_NO_MEMORY,
+ "BUG: dict allocation failed (pargfid: %s, name: %s), "
+ "still continuing", uuid_utoa (resolve_loc->gfid),
+ resolve_loc->name);
+
STACK_WIND (frame, resolve_gfid_entry_cbk,
frame->root->client->bound_xl,
frame->root->client->bound_xl->fops->lookup,
- &resolve->resolve_loc, state->xdata);
+ &resolve->resolve_loc, dict);
+ if (dict)
+ dict_unref (dict);
return 0;
out:
resolve_continue (frame);
@@ -185,6 +195,7 @@ resolve_gfid (call_frame_t *frame)
server_resolve_t *resolve = NULL;
loc_t *resolve_loc = NULL;
int ret = 0;
+ dict_t *xdata = NULL;
state = CALL_STATE (frame);
this = frame->this;
@@ -199,10 +210,21 @@ resolve_gfid (call_frame_t *frame)
resolve_loc->inode = inode_new (state->itable);
ret = loc_path (resolve_loc, NULL);
+ xdata = dict_copy_with_ref (state->xdata, NULL);
+ if (!xdata && state->xdata)
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM, PS_MSG_NO_MEMORY,
+ "BUG: dict allocation failed (gfid: %s), "
+ "still continuing",
+ uuid_utoa (resolve_loc->gfid));
+
STACK_WIND (frame, resolve_gfid_cbk,
frame->root->client->bound_xl,
frame->root->client->bound_xl->fops->lookup,
- &resolve->resolve_loc, state->xdata);
+ &resolve->resolve_loc, xdata);
+
+ if (xdata)
+ dict_unref (xdata);
+
return 0;
}