summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2017-09-15 14:49:50 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2017-09-17 13:37:32 +0000
commitd3b0205dbd299ff69883133ce22ca9d0623e87e2 (patch)
treeb9cf14264e55fc9910b04a5e0764df42f3c1d256 /xlators
parentd31c45e659d0fd0b740ecfb98b3b92dc8dcca039 (diff)
afr: heal metadata in discover code path
****************************************************** Backport of: https://review.gluster.org/18202 Also added loc_is_nameless() to libglusterfs since the patch that introduced it in master was not backported to release-3.10. Note: 18202 is a squash of 17850 and 18187 in master. ****************************************************** During graph switch, if fuse sends nameless (gfid) lookups, afr takes the discover code path to serve it. If there are pending metadata heals, they do not happen unless an inode refresh happens as a part of discover (which is not guaranteed to happen always). This patch fixes it by attempting metadata heal as a part of discover, just like how it is done in lookup code path. Change-Id: I87c493045b9225741cad173bf3f645848697032e BUG: 1492010 Signed-off-by: Ravishankar N <ravishankar@redhat.com> Reviewed-on: https://review.gluster.org/18304 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/afr/src/afr-common.c59
-rw-r--r--xlators/cluster/afr/src/afr-self-heal.h4
2 files changed, 46 insertions, 17 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index bd8acb6abb7..73550befc23 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -60,6 +60,9 @@ int
afr_fav_child_reset_sink_xattrs_cbk (int ret, call_frame_t *frame,
void *opaque);
+static void
+afr_discover_done (call_frame_t *frame, xlator_t *this);
+
gf_boolean_t
afr_is_consistent_io_possible (afr_local_t *local, afr_private_t *priv,
int32_t *op_errno)
@@ -1037,7 +1040,7 @@ int
afr_refresh_selfheal_done (int ret, call_frame_t *heal, void *opaque)
{
if (heal)
- STACK_DESTROY (heal->root);
+ AFR_STACK_DESTROY (heal);
return 0;
}
@@ -2421,13 +2424,25 @@ afr_lookup_sh_metadata_wrap (void *opaque)
"Unable to set link-count in dict ");
}
- inode = afr_selfheal_unlocked_lookup_on (frame, local->loc.parent,
- local->loc.name, local->replies,
- local->child_up, dict);
+ if (loc_is_nameless (&local->loc)) {
+ ret = afr_selfheal_unlocked_discover_on (frame, local->inode,
+ local->loc.gfid,
+ local->replies,
+ local->child_up);
+ } else {
+ inode = afr_selfheal_unlocked_lookup_on (frame,
+ local->loc.parent,
+ local->loc.name,
+ local->replies,
+ local->child_up, dict);
+ }
if (inode)
inode_unref (inode);
out:
- afr_lookup_done (frame, this);
+ if (loc_is_nameless (&local->loc))
+ afr_discover_done (frame, this);
+ else
+ afr_lookup_done (frame, this);
if (dict)
dict_unref (dict);
@@ -2492,21 +2507,29 @@ afr_lookup_metadata_heal_check (call_frame_t *frame, xlator_t *this)
{
call_frame_t *heal = NULL;
+ afr_local_t *local = NULL;
int ret = 0;
+ local = frame->local;
if (!afr_can_start_metadata_self_heal (frame, this))
goto out;
- heal = copy_frame (frame);
- if (heal)
- heal->root->pid = GF_CLIENT_PID_SELF_HEALD;
+ heal = afr_frame_create (this);
+ if (!heal)
+ goto out;
+
ret = synctask_new (this->ctx->env, afr_lookup_sh_metadata_wrap,
afr_refresh_selfheal_done, heal, frame);
- if(ret)
+ if (ret)
goto out;
return ret;
out:
- afr_lookup_done (frame, this);
+ if (loc_is_nameless (&local->loc))
+ afr_discover_done (frame, this);
+ else
+ afr_lookup_done (frame, this);
+ if (heal)
+ AFR_STACK_DESTROY (heal);
return ret;
}
@@ -2587,13 +2610,15 @@ afr_lookup_entry_heal (call_frame_t *frame, xlator_t *this)
}
if (need_heal) {
- heal = copy_frame (frame);
- if (heal)
- heal->root->pid = GF_CLIENT_PID_SELF_HEALD;
+ heal = afr_frame_create (this);
+ if (!heal)
+ goto metadata_heal;
ret = synctask_new (this->ctx->env, afr_lookup_selfheal_wrap,
afr_refresh_selfheal_done, heal, frame);
- if (ret)
+ if (ret) {
+ AFR_STACK_DESTROY (heal);
goto metadata_heal;
+ }
return ret;
}
metadata_heal:
@@ -2755,8 +2780,8 @@ afr_discover_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
call_count = afr_frame_return (frame);
if (call_count == 0) {
- afr_set_need_heal (this, local);
- afr_discover_done (frame, this);
+ afr_set_need_heal (this, local);
+ afr_lookup_metadata_heal_check (frame, this);
}
return 0;
@@ -2969,7 +2994,7 @@ afr_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req)
void *gfid_req = NULL;
int ret = 0;
- if (!loc->parent && gf_uuid_is_null (loc->pargfid)) {
+ if (loc_is_nameless (loc)) {
if (xattr_req)
dict_del (xattr_req, "gfid-req");
afr_discover (frame, this, loc, xattr_req);
diff --git a/xlators/cluster/afr/src/afr-self-heal.h b/xlators/cluster/afr/src/afr-self-heal.h
index 04463cccfc9..ded4903a4c7 100644
--- a/xlators/cluster/afr/src/afr-self-heal.h
+++ b/xlators/cluster/afr/src/afr-self-heal.h
@@ -145,6 +145,10 @@ int
afr_selfheal_unlocked_discover (call_frame_t *frame, inode_t *inode,
uuid_t gfid, struct afr_reply *replies);
+int
+afr_selfheal_unlocked_discover_on (call_frame_t *frame, inode_t *inode,
+ uuid_t gfid, struct afr_reply *replies,
+ unsigned char *discover_on);
inode_t *
afr_selfheal_unlocked_lookup_on (call_frame_t *frame, inode_t *parent,
const char *name, struct afr_reply *replies,