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