14f8ab
From fb1d503791c874296afab0cd7be59b6865340d72 Mon Sep 17 00:00:00 2001
14f8ab
From: Xavi Hernandez <jahernan@redhat.com>
14f8ab
Date: Wed, 25 Sep 2019 11:56:35 +0200
14f8ab
Subject: [PATCH 302/302] cluster/ec: prevent filling shd log with "table not
14f8ab
 found" messages
14f8ab
14f8ab
When self-heal daemon receives an inodelk contention notification, it tries
14f8ab
to locate the related inode using inode_find() and the inode table owned by
14f8ab
top-most xlator, which in this case doesn't have any inode table. This causes
14f8ab
many messages to be logged by inode_find() function because the inode table
14f8ab
passed is NULL.
14f8ab
14f8ab
This patch prevents this by making sure the inode table is not NULL before
14f8ab
calling inode_find().
14f8ab
14f8ab
Upstream patch:
14f8ab
> Change-Id: I8d001bd180aaaf1521ba40a536b097fcf70c991f
14f8ab
> Upstream patch link: https://review.gluster.org/c/glusterfs/+/23481
14f8ab
> Fixes: bz#1755344
14f8ab
> Signed-off-by: Xavi Hernandez <jahernan@redhat.com>
14f8ab
14f8ab
Change-Id: I8d001bd180aaaf1521ba40a536b097fcf70c991f
14f8ab
BUG: 1754790
14f8ab
Signed-off-by: Xavi Hernandez <jahernan@redhat.com>
14f8ab
Reviewed-on: https://code.engineering.redhat.com/gerrit/182207
14f8ab
Tested-by: RHGS Build Bot <nigelb@redhat.com>
14f8ab
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
14f8ab
---
14f8ab
 xlators/cluster/ec/src/ec.c | 15 +++++++++++++--
14f8ab
 1 file changed, 13 insertions(+), 2 deletions(-)
14f8ab
14f8ab
diff --git a/xlators/cluster/ec/src/ec.c b/xlators/cluster/ec/src/ec.c
14f8ab
index 19094c4..3f31c74 100644
14f8ab
--- a/xlators/cluster/ec/src/ec.c
14f8ab
+++ b/xlators/cluster/ec/src/ec.c
14f8ab
@@ -463,6 +463,7 @@ ec_upcall(ec_t *ec, struct gf_upcall *upcall)
14f8ab
     struct gf_upcall_cache_invalidation *ci = NULL;
14f8ab
     struct gf_upcall_inodelk_contention *lc = NULL;
14f8ab
     inode_t *inode;
14f8ab
+    inode_table_t *table;
14f8ab
 
14f8ab
     switch (upcall->event_type) {
14f8ab
         case GF_UPCALL_CACHE_INVALIDATION:
14f8ab
@@ -476,8 +477,18 @@ ec_upcall(ec_t *ec, struct gf_upcall *upcall)
14f8ab
                 /* The lock is not owned by EC, ignore it. */
14f8ab
                 return _gf_true;
14f8ab
             }
14f8ab
-            inode = inode_find(((xlator_t *)ec->xl->graph->top)->itable,
14f8ab
-                               upcall->gfid);
14f8ab
+            table = ((xlator_t *)ec->xl->graph->top)->itable;
14f8ab
+            if (table == NULL) {
14f8ab
+                /* Self-heal daemon doesn't have an inode table on the top
14f8ab
+                 * xlator because it doesn't need it. In this case we should
14f8ab
+                 * use the inode table managed by EC itself where all inodes
14f8ab
+                 * being healed should be present. However self-heal doesn't
14f8ab
+                 * use eager-locking and inodelk's are already released as
14f8ab
+                 * soon as possible. In this case we can safely ignore these
14f8ab
+                 * notifications. */
14f8ab
+                return _gf_false;
14f8ab
+            }
14f8ab
+            inode = inode_find(table, upcall->gfid);
14f8ab
             /* If inode is not found, it means that it's already released,
14f8ab
              * so we can ignore it. Probably it has been released and
14f8ab
              * destroyed while the contention notification was being sent.
14f8ab
-- 
14f8ab
1.8.3.1
14f8ab