diff options
Diffstat (limited to 'xlators/cluster/dht')
-rw-r--r-- | xlators/cluster/dht/src/dht-messages.h | 10 | ||||
-rw-r--r-- | xlators/cluster/dht/src/tier.c | 29 |
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 6ea245d0c15..4403efc151c 100644 --- a/xlators/cluster/dht/src/dht-messages.h +++ b/xlators/cluster/dht/src/dht-messages.h @@ -40,7 +40,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 */ @@ -1042,5 +1042,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 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); |