From 06061aaa447f03e2522483d02525619ebc9854db Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Thu, 24 Jan 2019 12:14:11 +0530 Subject: afr/self-heal:Fix wrong type checking gf_dirent struct has d_type variable which should check with DT_DIR istead of IA_IFDIR or IA_IFDIR has to compare with entry->d_stat.ia_type Change-Id: Idf1059ce2a590734bc5b6adaad73604d9a708804 updates: bz#1653359 Signed-off-by: Mohammed Rafi KC --- xlators/features/index/src/index.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'xlators/features/index/src/index.c') diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c index d9768b32d7f..2f2a6d04fb3 100644 --- a/xlators/features/index/src/index.c +++ b/xlators/features/index/src/index.c @@ -1685,21 +1685,25 @@ index_get_gfid_type(void *opaque) loc_wipe(&loc); - entry->d_type = IA_INVAL; + entry->d_type = gf_d_type_from_ia_type(IA_INVAL); + entry->d_stat.ia_type = IA_INVAL; if (gf_uuid_parse(entry->d_name, loc.gfid)) continue; loc.inode = inode_find(args->parent->table, loc.gfid); if (loc.inode) { - entry->d_type = loc.inode->ia_type; + entry->d_stat.ia_type = loc.inode->ia_type; + entry->d_type = gf_d_type_from_ia_type(loc.inode->ia_type); continue; } loc.inode = inode_new(args->parent->table); if (!loc.inode) continue; ret = syncop_lookup(FIRST_CHILD(this), &loc, &iatt, 0, 0, 0); - if (ret == 0) - entry->d_type = iatt.ia_type; + if (ret == 0) { + entry->d_type = gf_d_type_from_ia_type(iatt.ia_type); + entry->d_stat = iatt; + } } loc_wipe(&loc); -- cgit