diff options
author | hari gowtham <hgowtham@redhat.com> | 2016-02-23 20:09:52 +0530 |
---|---|---|
committer | Dan Lambright <dlambrig@redhat.com> | 2016-03-13 23:05:42 -0700 |
commit | d9b5fef0333e63db9d3b5077968254e3ea9d2af4 (patch) | |
tree | 5b507ac0eb277fc4ef9f9697ab6ce88145b08e50 /xlators/cluster/dht/src/tier.c | |
parent | 68b840267ed0f6864e4cf5ba7d842988c0fb3da8 (diff) |
Tier: Avoiding stale entries from causing demotion to stop
When the parent GFID is a stale entry, the lookup on this parent
fails and this in turn fails the demotion process.
This patch will make the stale entry error to be skipped.
Situation for pargfid to be stale:
Consider a folder from a tar file. Once the tar file is untared
the files in the tar-file will start to demote.
when the demotion is under progress, if we tend to delete
the actual folder, then the files under it which are
undergoing demotion will do a lookup on the parent which was
deleted and become stale entry. This stale entry fails the
Lookup and this will fail the demotion of the other files(not from
tar) that are supposed to be demoted.
Change-Id: I3d47c32c4077526d477a25912b0135bab98b23fc
BUG: 1311178
Signed-off-by: hari gowtham <hgowtham@redhat.com>
Reviewed-on: http://review.gluster.org/13501
Tested-by: hari gowtham <hari.gowtham005@gmail.com>
Smoke: Gluster Build System <jenkins@build.gluster.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/cluster/dht/src/tier.c')
-rw-r--r-- | xlators/cluster/dht/src/tier.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c index 28ec8041f12..f35787ec010 100644 --- a/xlators/cluster/dht/src/tier.c +++ b/xlators/cluster/dht/src/tier.c @@ -625,7 +625,19 @@ tier_migrate_using_query_file (void *_args) ret = syncop_lookup (this, &p_loc, &par_stbuf, NULL, xdata_request, &xdata_response); - if (ret) { + /* When the parent gfid is a stale entry, the lookup + * will fail and stop the demotion process. + * The parent gfid can be stale when a huge folder is + * deleted while the files within it are being migrated + */ + if (ret == -ESTALE) { + gf_msg (this->name, GF_LOG_WARNING, -ret, + DHT_MSG_STALE_LOOKUP, + "Stale entry in parent lookup for %s", + uuid_utoa (p_loc.gfid)); + per_link_status = 1; + goto abort; + } else if (ret) { gf_msg (this->name, GF_LOG_ERROR, -ret, DHT_MSG_LOG_TIER_ERROR, "Error in parent lookup for %s", @@ -683,7 +695,20 @@ tier_migrate_using_query_file (void *_args) /* lookup file inode */ ret = syncop_lookup (this, &loc, ¤t, NULL, NULL, NULL); - if (ret) { + /* The file may be deleted even when the parent + * is available and the lookup will + * return a stale entry which would stop the + * migration. so if its a stale entry, then skip + * the file and keep migrating. + */ + if (ret == -ESTALE) { + gf_msg (this->name, GF_LOG_WARNING, -ret, + DHT_MSG_STALE_LOOKUP, + "Stale lookup for %s", + uuid_utoa (p_loc.gfid)); + per_link_status = 1; + goto abort; + } else if (ret) { gf_msg (this->name, GF_LOG_ERROR, -ret, DHT_MSG_LOG_TIER_ERROR, "Failed to " "lookup file %s\n", loc.name); |