summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht
diff options
context:
space:
mode:
authorhari gowtham <hgowtham@redhat.com>2016-02-23 20:09:52 +0530
committerDan Lambright <dlambrig@redhat.com>2016-03-22 02:06:48 -0700
commit84d378dcb3cfae9e643eb548e9861cfb274df15e (patch)
tree0a43c2d367297db1386a2d89e9c1398735f75bb2 /xlators/cluster/dht
parent35c401430a964f62d7e13db5d2294e43b2bba36a (diff)
Tier: Avoiding stale entries from causing demotion to stop
back-port of : http://review.gluster.org/#/c/13501/ 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> Change-Id: I80a77d149180e2a05b3d7943f370b3ef162e545b BUG: 1317366 Signed-off-by: Hari Gowtham <hgowtham@redhat.com> Reviewed-on: http://review.gluster.org/13692 Smoke: Gluster Build System <jenkins@build.gluster.com> Tested-by: hari gowtham <hari.gowtham005@gmail.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'xlators/cluster/dht')
-rw-r--r--xlators/cluster/dht/src/dht-messages.h10
-rw-r--r--xlators/cluster/dht/src/tier.c29
2 files changed, 36 insertions, 3 deletions
diff --git a/xlators/cluster/dht/src/dht-messages.h b/xlators/cluster/dht/src/dht-messages.h
index f1fdd4b93ea..129707d5f59 100644
--- a/xlators/cluster/dht/src/dht-messages.h
+++ b/xlators/cluster/dht/src/dht-messages.h
@@ -45,7 +45,7 @@
*/
#define GLFS_DHT_BASE GLFS_MSGID_COMP_DHT
-#define GLFS_DHT_NUM_MESSAGES 112
+#define GLFS_DHT_NUM_MESSAGES 113
#define GLFS_MSGID_END (GLFS_DHT_BASE + GLFS_DHT_NUM_MESSAGES + 1)
/* Messages with message IDs */
@@ -1047,5 +1047,13 @@
#define DHT_MSG_FD_CTX_SET_FAILED (GLFS_DHT_BASE + 112)
+/*
+ * @messageid 109112
+ * @diagnosis
+ * @recommendedaction None
+ */
+
+#define DHT_MSG_STALE_LOOKUP (GLFS_DHT_BASE + 113)
+
#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
#endif /* _DHT_MESSAGES_H_ */
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c
index 199a344754e..ca81ef08af8 100644
--- a/xlators/cluster/dht/src/tier.c
+++ b/xlators/cluster/dht/src/tier.c
@@ -639,7 +639,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",
@@ -697,7 +709,20 @@ tier_migrate_using_query_file (void *_args)
/* lookup file inode */
ret = syncop_lookup (this, &loc, &current, 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);