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