summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/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 /xlators/storage/posix/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 'xlators/storage/posix/src')
-rw-r--r--xlators/storage/posix/src/posix-inode-fd-ops.c29
1 files changed, 1 insertions, 28 deletions
diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c
index 0aabff2615b..7dbbd3d6d61 100644
--- a/xlators/storage/posix/src/posix-inode-fd-ops.c
+++ b/xlators/storage/posix/src/posix-inode-fd-ops.c
@@ -5306,31 +5306,6 @@ posix_entry_xattr_fill(xlator_t *this, inode_t *inode, fd_t *fd,
return posix_xattr_fill(this, entry_path, &tmp_loc, NULL, -1, dict, stbuf);
}
-#ifdef _DIRENT_HAVE_D_TYPE
-static int
-posix_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;
- }
-}
-#endif
-
int
posix_readdirp_fill(xlator_t *this, fd_t *fd, gf_dirent_t *entries,
dict_t *dict)
@@ -5405,14 +5380,12 @@ posix_readdirp_fill(xlator_t *this, fd_t *fd, gf_dirent_t *entries,
if (stbuf.ia_ino)
entry->d_ino = stbuf.ia_ino;
-#ifdef _DIRENT_HAVE_D_TYPE
if (entry->d_type == DT_UNKNOWN && !IA_ISINVAL(stbuf.ia_type)) {
/* The platform supports d_type but the underlying
filesystem doesn't. We set d_type to the correct
value from ia_type */
- entry->d_type = posix_d_type_from_ia_type(stbuf.ia_type);
+ entry->d_type = gf_d_type_from_ia_type(stbuf.ia_type);
}
-#endif
inode = NULL;
}