From 67feb849ef96431ad869ce904c5de727195758cf Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Wed, 14 Dec 2016 22:48:20 +0530 Subject: glfsheal: Explicitly enable self-heal xlator options Enable data, metadata and entry self-heal as xlator-options so that glfs-heal.c can heal split-brain files even if they are disabled on the volume via volume set commands. > Reviewed-on: http://review.gluster.org/11333 > Smoke: Gluster Build System > Reviewed-by: Pranith Kumar Karampuri > Tested-by: Pranith Kumar Karampuri > NetBSD-regression: NetBSD Build System > CentOS-regression: Gluster Build System (cherry picked from commit 209c2d447be874047cb98d86492b03fa807d1832) Change-Id: Ic191a1017131db1ded94d97c932079d7bfd79457 BUG: 1405130 Signed-off-by: Ravishankar N Reviewed-on: http://review.gluster.org/16144 Reviewed-by: Pranith Kumar Karampuri Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- heal/src/glfs-heal.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'heal') diff --git a/heal/src/glfs-heal.c b/heal/src/glfs-heal.c index a306d8962fa..c65682a5517 100644 --- a/heal/src/glfs-heal.c +++ b/heal/src/glfs-heal.c @@ -871,6 +871,31 @@ out: } +static int +glfsh_set_heal_options (glfs_t *fs, gf_xl_afr_op_t heal_op) +{ + int ret = 0; + + if ((heal_op != GF_SHD_OP_SBRAIN_HEAL_FROM_BIGGER_FILE) && + (heal_op != GF_SHD_OP_SBRAIN_HEAL_FROM_BRICK) && + (heal_op != GF_SHD_OP_SBRAIN_HEAL_FROM_LATEST_MTIME)) + return 0; + ret = glfs_set_xlator_option (fs, "*-replicate-*", "data-self-heal", + "on"); + if (ret) + goto out; + + ret = glfs_set_xlator_option (fs, "*-replicate-*", "metadata-self-heal", + "on"); + if (ret) + goto out; + + ret = glfs_set_xlator_option (fs, "*-replicate-*", "entry-self-heal", + "on"); +out: + return ret; +} + static int glfsh_validate_volume (xlator_t *xl, gf_xl_afr_op_t heal_op) { @@ -1343,6 +1368,13 @@ main (int argc, char **argv) "%s", strerror (errno)); goto out; } + + ret = glfsh_set_heal_options (fs, heal_op); + if (ret) { + printf ("Setting xlator heal options failed, %s\n", + strerror(errno)); + goto out; + } snprintf (logfilepath, sizeof (logfilepath), DEFAULT_HEAL_LOG_FILE_DIRECTORY"/glfsheal-%s.log", volname); ret = glfs_set_logging(fs, logfilepath, GF_LOG_INFO); -- cgit