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