summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.h2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c62
3 files changed, 63 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 578b39363ed..64eb688efb2 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -110,8 +110,6 @@ typedef struct glusterd_quota_child_info {
static int
glusterd_restart_brick_servers (glusterd_volinfo_t *);
-static int
-glusterd_check_gsync_running (glusterd_volinfo_t *volinfo, gf_boolean_t *flag);
char*
@@ -2351,7 +2349,7 @@ out:
return ret;
}
-static int
+int
glusterd_check_gsync_running (glusterd_volinfo_t *volinfo, gf_boolean_t *flag)
{
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.h b/xlators/mgmt/glusterd/src/glusterd-op-sm.h
index 52e36ed3a71..d550b108cca 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.h
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.h
@@ -306,4 +306,6 @@ gsync_status (char *master, char *slave, int *status);
int
glusterd_gsync_get_param_file (char *prmfile, const char *ext, char *master,
char *slave, char *gl_workdir);
+int
+glusterd_check_gsync_running (glusterd_volinfo_t *volinfo, gf_boolean_t *flag);
#endif
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 1cea50bda2b..d5c5d5bdb9e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -35,6 +35,7 @@
#include "glusterd-mem-types.h"
#include "cli1.h"
#include "glusterd-volgen.h"
+#include "glusterd-op-sm.h"
/* dispatch table for VOLUME SET
@@ -155,6 +156,7 @@ static struct volopt_map_entry glusterd_volopt_map[] = {
{VKEY_PERF_STAT_PREFETCH, "performance/stat-prefetch", "!perf", "on", NO_DOC, 0},
{VKEY_MARKER_XTIME, "features/marker", "xtime", "off", NO_DOC, OPT_FLAG_FORCE},
+ {VKEY_MARKER_XTIME, "features/marker", "!xtime", "off", NO_DOC, OPT_FLAG_FORCE},
{"nfs.enable-ino32", "nfs/server", "nfs.enable-ino32", NULL, GLOBAL_DOC, 0},
{"nfs.mem-factor", "nfs/server", "nfs.mem-factor", NULL, GLOBAL_DOC, 0},
@@ -1169,13 +1171,69 @@ loglevel_option_handler (glusterfs_graph_t *graph,
}
static int
+server_check_marker_off (struct volopt_map_entry *vme,
+ glusterd_volinfo_t *volinfo)
+{
+ gf_boolean_t bool = _gf_false;
+ int ret = 0;
+
+ GF_ASSERT (volinfo);
+ GF_ASSERT (vme);
+
+ if (strcmp (vme->option, "!xtime") != 0)
+ return 0;
+
+ ret = gf_string2boolean (vme->value, &bool);
+ if (ret || bool)
+ goto out;
+
+ ret = glusterd_volinfo_get_boolean (volinfo, VKEY_MARKER_XTIME);
+ if (ret < 0) {
+ gf_log ("", GF_LOG_WARNING, "failed to get the marker status");
+ ret = -1;
+ goto out;
+ }
+
+ if (ret) {
+ bool = _gf_false;
+ ret = glusterd_check_gsync_running (volinfo, &bool);
+
+ if (bool) {
+ gf_log ("", GF_LOG_WARNING, "Gsync sessions active"
+ "for the volume %s, cannot disable marker "
+ ,volinfo->volname);
+ ret = -1;
+ goto out;
+ }
+
+ if (ret) {
+ gf_log ("", GF_LOG_WARNING, "Unable to get the status"
+ " of active gsync session");
+ goto out;
+ }
+ }
+
+ ret = 0;
+ out:
+ gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ return ret;
+
+}
+
+static int
server_spec_option_handler (glusterfs_graph_t *graph,
struct volopt_map_entry *vme, void *param)
{
- int ret = 0;
+ int ret = 0;
+ glusterd_volinfo_t *volinfo = NULL;
+
+ volinfo = param;
ret = server_auth_option_handler (graph, vme, NULL);
if (!ret)
+ ret = server_check_marker_off (vme, volinfo);
+
+ if (!ret)
ret = loglevel_option_handler (graph, vme, "brick");
return ret;
@@ -1272,7 +1330,7 @@ server_graph_builder (glusterfs_graph_t *graph, glusterd_volinfo_t *volinfo,
if (ret)
return -1;
- ret = volgen_graph_set_options_generic (graph, set_dict, NULL,
+ ret = volgen_graph_set_options_generic (graph, set_dict, volinfo,
&server_spec_option_handler);
return ret;