From 19460ebc988795eeabaeb8e25d6eba9a3cf2864b Mon Sep 17 00:00:00 2001
From: karthik-us <ksubrahm@redhat.com>
Date: Mon, 4 Oct 2021 12:44:21 +0530
Subject: [PATCH 591/610] afr: check for valid iatt
Problem:
If the entry being processed by afr_shd_anon_inode_cleaner() is no
longer present, gfid lookup fails with ENOENT on all bricks and iatt
will never be assigned, causing a crash due to null dereference.
Fix:
Add a null-check for iatt.
> Upstream patch: https://github.com/gluster/glusterfs/pull/2660
> Fixes: gluster#2659
> Change-Id: I6abfc8063677861ce9388ca4efdf491ec956dc74
> Signed-off-by: Ravishankar N <ravishankar@redhat.com>
BUG: 1995029
Change-Id: I6abfc8063677861ce9388ca4efdf491ec956dc74
Signed-off-by: karthik-us <ksubrahm@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/c/rhs-glusterfs/+/279529
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
xlators/cluster/afr/src/afr-self-heald.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c
index 18aed93..bc720cf 100644
--- a/xlators/cluster/afr/src/afr-self-heald.c
+++ b/xlators/cluster/afr/src/afr-self-heald.c
@@ -870,7 +870,7 @@ afr_shd_anon_inode_cleaner(xlator_t *subvol, gf_dirent_t *entry, loc_t *parent,
}
/*Inode is deleted from subvol*/
- if (count == 1 || (iatt->ia_type != IA_IFDIR && multiple_links)) {
+ if (count == 1 || (iatt && iatt->ia_type != IA_IFDIR && multiple_links)) {
gf_msg(healer->this->name, GF_LOG_WARNING, 0,
AFR_MSG_EXPUNGING_FILE_OR_DIR, "expunging %s %s/%s on %s", type,
priv->anon_inode_name, entry->d_name, subvol->name);
--
1.8.3.1