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