diff options
| author | Raghavendra G <rgowdapp@redhat.com> | 2016-05-13 11:40:57 +0530 | 
|---|---|---|
| committer | Raghavendra G <rgowdapp@redhat.com> | 2016-06-28 01:49:47 -0700 | 
| commit | 4b9132de1710be9b437b0dfbfdcf2bfeecee9db3 (patch) | |
| tree | cd2a9e0603d0935b72703c20104f02b3aec4595b /xlators/cluster/dht/src | |
| parent | 37fa947743d5e56baa617fc2e72485a1907b39d2 (diff) | |
cluster/distribute: heal layout in discover codepath too
Backport of commit a74f8cf4e7edc2ce9f045317a18dacddf25adb8a:
> BUG: 1334164
> Change-Id: I4259d88f2b6e4f9d4ad689bc4e438f1db9cfd177
> Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
> Reviewed-on: http://review.gluster.org/14365
> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
> Smoke: Gluster Build System <jenkins@build.gluster.com>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Change-Id: Ic559c220a1f0051e531314d13940604e2dead08c
BUG: 1348060
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Reviewed-on: http://review.gluster.org/14351
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: N Balachandran <nbalacha@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src')
| -rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 40 | 
1 files changed, 7 insertions, 33 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 21962cd342c..c667266fed8 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -250,7 +250,7 @@ dht_discover_complete (xlator_t *this, call_frame_t *discover_frame)          int              heal_path       = 0;          int              i               = 0;          loc_t            loc             = {0 }; -        int8_t           is_read_only    = 0; +        int8_t           is_read_only    = 0, layout_anomalies = 0;          local = discover_frame->local;          layout = local->layout; @@ -305,26 +305,10 @@ dht_discover_complete (xlator_t *this, call_frame_t *discover_frame)                                        "(overlaps/holes present: %s, "                                        "ENOENT errors: %d)", local->loc.path,                                        (ret < 0) ? "yes" : "no", (ret > 0) ? ret : 0); -                        if ((ret > 0) && (ret == conf->subvolume_cnt)) { -                                op_errno = ESTALE; -                                goto out; -                        } - -                        /* For fixing the directory layout, we need to choose -                         * the subvolume on which layout will be set first. -                         * Because in nameless lookup, we have gfid only, -                         * we are dependent on gfid. Therefore if conf-> -                         * randomize_by_gfid is set, then only we proceed for -                         * healing layout of directory otherwise we don't heal. -                         */ - -                        if (local->inode && conf->randomize_by_gfid && -                            !is_read_only) -                                goto selfheal; -                } - -                if (local->inode) +                        layout_anomalies = 1; +                } else if (local->inode) {                          dht_layout_set (this, local->inode, layout); +                }          }          if (!conf->vch_forced) { @@ -344,11 +328,13 @@ dht_discover_complete (xlator_t *this, call_frame_t *discover_frame)                              layout->list[i].err == ESTALE) {                                  heal_path = 1;                          } +                          if (source && heal_path)                                  break;                  }          } -        if (source && heal_path) { + +        if (source && (heal_path || layout_anomalies)) {                  gf_uuid_copy (loc.gfid, local->gfid);                  if (gf_uuid_is_null (loc.gfid)) {                          goto done; @@ -403,18 +389,6 @@ out:                            NULL);          return ret; - -selfheal: - -        main_frame->local = local; -        discover_frame->local =  NULL; -        FRAME_SU_DO (main_frame, dht_local_t); -        gf_uuid_copy (local->loc.gfid, local->gfid); -        ret = dht_selfheal_directory_for_nameless_lookup (main_frame, -                                                        dht_lookup_selfheal_cbk, -                                                          &local->loc, layout); -        return ret; -  }  int  | 
