diff options
Diffstat (limited to 'xlators/cluster')
| -rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 59 | ||||
| -rw-r--r-- | xlators/cluster/afr/src/afr-self-heal.h | 4 | 
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,  | 
