summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2019-01-24 12:14:11 +0530
committerAmar Tumballi <amarts@redhat.com>2019-01-24 12:16:50 +0000
commit06061aaa447f03e2522483d02525619ebc9854db (patch)
tree814472e5c7e5c1c36e034ab10366c544fa65e275 /libglusterfs/src
parent04f84756e1baa5eff4560339700f82970eaa5d80 (diff)
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 <rkavunga@redhat.com>
Diffstat (limited to 'libglusterfs/src')
-rw-r--r--libglusterfs/src/common-utils.c23
-rw-r--r--libglusterfs/src/glusterfs/common-utils.h3
-rw-r--r--libglusterfs/src/libglusterfs.sym1
-rw-r--r--libglusterfs/src/syncop-utils.c2
4 files changed, 28 insertions, 1 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 0798661806d..e16bb330a44 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -5341,3 +5341,26 @@ find_xlator_option_in_cmd_args_t(const char *option_name, cmd_args_t *args)
}
return NULL;
}
+
+int
+gf_d_type_from_ia_type(ia_type_t type)
+{
+ switch (type) {
+ case IA_IFDIR:
+ return DT_DIR;
+ case IA_IFCHR:
+ return DT_CHR;
+ case IA_IFBLK:
+ return DT_BLK;
+ case IA_IFIFO:
+ return DT_FIFO;
+ case IA_IFLNK:
+ return DT_LNK;
+ case IA_IFREG:
+ return DT_REG;
+ case IA_IFSOCK:
+ return DT_SOCK;
+ default:
+ return DT_UNKNOWN;
+ }
+}
diff --git a/libglusterfs/src/glusterfs/common-utils.h b/libglusterfs/src/glusterfs/common-utils.h
index 9061861ce3b..89b38e02448 100644
--- a/libglusterfs/src/glusterfs/common-utils.h
+++ b/libglusterfs/src/glusterfs/common-utils.h
@@ -1067,4 +1067,7 @@ gf_replace_new_iatt_in_dict(struct _dict *);
xlator_cmdline_option_t *
find_xlator_option_in_cmd_args_t(const char *option_name, cmd_args_t *args);
+int
+gf_d_type_from_ia_type(ia_type_t type);
+
#endif /* _COMMON_UTILS_H */
diff --git a/libglusterfs/src/libglusterfs.sym b/libglusterfs/src/libglusterfs.sym
index beeab5468f9..f0a92796187 100644
--- a/libglusterfs/src/libglusterfs.sym
+++ b/libglusterfs/src/libglusterfs.sym
@@ -1150,3 +1150,4 @@ gf_changelog_init
gf_changelog_register_generic
gf_gfid_generate_from_xxh64
find_xlator_option_in_cmd_args_t
+gf_d_type_from_ia_type
diff --git a/libglusterfs/src/syncop-utils.c b/libglusterfs/src/syncop-utils.c
index 13e7165658e..be03527496e 100644
--- a/libglusterfs/src/syncop-utils.c
+++ b/libglusterfs/src/syncop-utils.c
@@ -403,7 +403,7 @@ syncop_mt_dir_scan(call_frame_t *frame, xlator_t *subvol, loc_t *loc, int pid,
continue;
}
- if (entry->d_type == IA_IFDIR) {
+ if (entry->d_stat.ia_type == IA_IFDIR) {
ret = fn(subvol, entry, loc, data);
gf_dirent_entry_free(entry);
if (ret)