Blob Blame History Raw
From 4e395d1bdc3f1349b6b2ee1ecc306f975b6cc4d9 Mon Sep 17 00:00:00 2001
From: Ashish Pandey <aspandey@redhat.com>
Date: Tue, 4 Jul 2017 16:18:20 +0530
Subject: [PATCH 543/557] cluster/ec : Don't try to heal when no sink is UP

Problem:
4 + 2 EC volume configuration.
If untar of linux is going on and we kill a brick,
indices will be created for the files/dir which need
to be healed. ec_shd_index_sweep spawns threads to
scan these entries and start heal. If in the middle
of this we kill one more brick, we end up in a
situation where we can not heal an entry as there
are only "ec->fragment" number of bricks are UP.
However, the scan will be continued and it will
trigger the heal for those entries.

Solution:
When a heal is triggered for an entry, check if it
*CAN* be healed or not. If not come out with ENOTCONN.

>Change-Id: I305be7701c289f36bd7bde22491b71074771424f
>BUG: 1464359
>Signed-off-by: Ashish Pandey <aspandey@redhat.com>
>Reviewed-on: https://review.gluster.org/17692
>Smoke: Gluster Build System <jenkins@build.gluster.org>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
>Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
>Reviewed-by: Sunil Kumar Acharya <sheggodu@redhat.com>
>Reviewed-by: Xavier Hernandez <xhernandez@datalab.es>
>Signed-off-by: Ashish Pandey <aspandey@redhat.com>

Change-Id: I305be7701c289f36bd7bde22491b71074771424f
BUG: 1464336
Signed-off-by: Ashish Pandey <aspandey@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/111303
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
 xlators/cluster/ec/src/ec-heald.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xlators/cluster/ec/src/ec-heald.c b/xlators/cluster/ec/src/ec-heald.c
index ffb78d5..2e8ece8 100644
--- a/xlators/cluster/ec/src/ec-heald.c
+++ b/xlators/cluster/ec/src/ec-heald.c
@@ -199,6 +199,9 @@ ec_shd_index_heal (xlator_t *subvol, gf_dirent_t *entry, loc_t *parent,
         int                  ret     = 0;
 
         ec = healer->this->private;
+        if (ec->xl_up_count <= ec->fragments) {
+                return -ENOTCONN;
+        }
         if (!ec->shd.enabled)
                 return -EBUSY;
 
@@ -281,6 +284,9 @@ ec_shd_full_heal (xlator_t *subvol, gf_dirent_t *entry, loc_t *parent,
         int                  ret    = 0;
 
         ec = this->private;
+        if (ec->xl_up_count <= ec->fragments) {
+                return -ENOTCONN;
+        }
         if (!ec->shd.enabled)
                 return -EBUSY;
 
-- 
1.8.3.1