diff options
Diffstat (limited to 'xlators/cluster/afr/src')
| -rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 3 | ||||
| -rw-r--r-- | xlators/cluster/afr/src/pump.c | 77 | 
2 files changed, 77 insertions, 3 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index ee5fa3a606e..53b5ca1995e 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -2539,6 +2539,9 @@ afr_notify (xlator_t *this, int32_t event,          case GF_EVENT_CHILD_UP:                  i = find_child_index (this, data); +                gf_log (this->name, GF_LOG_DEBUG, +                        "child=%d up", i); +                  afr_attempt_lock_recovery (this, i);                  child_up[i] = 1; diff --git a/xlators/cluster/afr/src/pump.c b/xlators/cluster/afr/src/pump.c index 39de7cbb9ba..dc21855770c 100644 --- a/xlators/cluster/afr/src/pump.c +++ b/xlators/cluster/afr/src/pump.c @@ -620,6 +620,53 @@ pump_complete_migration (xlator_t *this)  }  static int +pump_set_root_gfid (dict_t *dict) +{ +        uuid_t gfid; +        int ret = 0; + +        memset (gfid, 0, 16); +        gfid[15] = 1; + +        ret = afr_set_dict_gfid (dict, gfid); + +        return ret; +} + +static int +pump_lookup_sink (loc_t *loc) +{ +        xlator_t *this = NULL; +	struct iatt iatt, parent; +	dict_t *xattr_rsp; +        dict_t *xattr_req = NULL; +        int ret = 0; + +        this = THIS; + +        xattr_req = dict_new (); + +        ret = pump_set_root_gfid (xattr_req); +        if (ret) +                goto out; + +        ret = syncop_lookup (PUMP_SINK_CHILD (this), loc, +                             xattr_req, &iatt, &xattr_rsp, &parent); + +        if (ret) { +                gf_log (this->name, GF_LOG_DEBUG, +                        "Lookup on sink child failed"); +                goto out; +        } + +out: +        if (xattr_req) +                dict_unref (xattr_req); + +        return ret; +} + +static int  pump_task (void *data)  {  	xlator_t *this = NULL; @@ -628,7 +675,8 @@ pump_task (void *data)          loc_t loc;  	struct iatt iatt, parent; -	dict_t *xattr_rsp; +	dict_t *xattr_rsp = NULL; +        dict_t *xattr_req = NULL;          int ret = -1; @@ -638,8 +686,16 @@ pump_task (void *data)          assert (priv->root_inode);          build_root_loc (priv->root_inode, &loc); +        xattr_req = dict_new (); +        if (!xattr_req) { +                gf_log (this->name, GF_LOG_DEBUG, +                        "Out of memory"); +                ret = -1; +                goto out; +        } -        ret = syncop_lookup (this, &loc, NULL, +        pump_set_root_gfid (xattr_req); +        ret = syncop_lookup (this, &loc, xattr_req,                               &iatt, &xattr_rsp, &parent);          gf_log (this->name, GF_LOG_TRACE, @@ -654,10 +710,20 @@ pump_task (void *data)          pump_update_resume_path (this); +        pump_set_root_gfid (xattr_req); +        ret = pump_lookup_sink (&loc); +        if (ret) { +                pump_update_resume_path (this); +                goto out; +        } +          gf_pump_traverse_directory (&loc);          pump_complete_migration (this);  out: +        if (xattr_req) +                dict_unref (xattr_req); +  	return 0;  } @@ -698,7 +764,8 @@ pump_start (call_frame_t *pump_frame, xlator_t *this)          if (!pump_frame->root->lk_owner)                  pump_frame->root->lk_owner = PUMP_LK_OWNER; -	ret = synctask_new (pump_priv->env, pump_task, pump_task_completion, +	ret = synctask_new (pump_priv->env, pump_task, +                            pump_task_completion,                              pump_frame);          if (ret == -1) {                  gf_log (this->name, GF_LOG_DEBUG, @@ -891,6 +958,8 @@ pump_cmd_start_getxattr_cbk (call_frame_t *frame,          else {                  /* We're re-starting pump from a previous                     pause */ +                gf_log (this->name, GF_LOG_DEBUG, +                        "about to start synctask");                  ret = pump_start_synctask (this);                  need_unwind = 1;          } @@ -2210,6 +2279,8 @@ notify (xlator_t *this, int32_t event,          case GF_EVENT_CHILD_UP:                  if (is_xlator_pump_sink (child_xl))                          if (is_pump_start_pending (this)) { +                                gf_log (this->name, GF_LOG_DEBUG, +                                        "about to start synctask");                                  ret = pump_start_synctask (this);                                  if (ret < 0)                                          gf_log (this->name, GF_LOG_DEBUG,  | 
