summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/Makefile.am2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-hooks.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c7
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-quota.c6
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c92
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c31
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.h8
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c20
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c24
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c9
12 files changed, 118 insertions, 89 deletions
diff --git a/xlators/mgmt/glusterd/src/Makefile.am b/xlators/mgmt/glusterd/src/Makefile.am
index 933c440196d..b89ec6ddc81 100644
--- a/xlators/mgmt/glusterd/src/Makefile.am
+++ b/xlators/mgmt/glusterd/src/Makefile.am
@@ -29,7 +29,7 @@ noinst_HEADERS = glusterd.h glusterd-utils.h glusterd-op-sm.h \
AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src \
-I$(rpclibdir) -I$(CONTRIBDIR)/rbtree \
-I$(top_srcdir)/rpc/xdr/src -I$(top_srcdir)/rpc/rpc-lib/src \
- -I$(CONTRIBDIR)/uuid \
+ -I$(CONTRIBDIR)/uuid -I$(CONTRIBDIR)/mount \
-DSBIN_DIR=\"$(sbindir)\" -DDATADIR=\"$(localstatedir)\" \
-DGSYNCD_PREFIX=\"$(libexecdir)/glusterfs\"\
-DSYNCDAEMON_COMPILE=$(SYNCDAEMON_COMPILE) $(XML_CPPFLAGS)
diff --git a/xlators/mgmt/glusterd/src/glusterd-hooks.c b/xlators/mgmt/glusterd/src/glusterd-hooks.c
index 352b6ba1197..78730a5645f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-hooks.c
+++ b/xlators/mgmt/glusterd/src/glusterd-hooks.c
@@ -181,7 +181,7 @@ glusterd_hooks_set_volume_args (dict_t *dict, runner_t *runner)
goto out;
runner_add_arg (runner, "-o");
- for (i = 1; (ret == 0); i++) {
+ for (i = 1; ret == 0; i++) {
snprintf (query, sizeof (query), "key%d", i);
ret = dict_get_str (dict, query, &key);
if (ret)
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index fb5e097d9c1..c22c2ea63b9 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -1020,7 +1020,7 @@ glusterd_op_stage_reset_volume (dict_t *dict, char **op_errstr)
{
int ret = 0;
char *volname = NULL;
- gf_boolean_t exists = _gf_false;
+ int exists = 0;
char msg[2048] = {0};
char *key = NULL;
char *key_fixed = NULL;
@@ -1068,6 +1068,7 @@ glusterd_op_stage_reset_volume (dict_t *dict, char **op_errstr)
ret = -1;
goto out;
}
+
if (!exists) {
ret = snprintf (msg, sizeof (msg),
"Option %s does not exist", key);
@@ -1819,7 +1820,7 @@ glusterd_op_set_volume (dict_t *dict)
if (dict_count == 0) {
ret = glusterd_volset_help (NULL, &op_errstr);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "%s",
+ gf_log (this->name, GF_LOG_ERROR, "%s",
(op_errstr)? op_errstr:
"Volume set help internal error");
}
@@ -3262,7 +3263,7 @@ glusterd_is_get_op (xlator_t *this, glusterd_op_t op, dict_t *dict)
if (op == GD_OP_STATUS_VOLUME)
return _gf_true;
- if ((op == GD_OP_SET_VOLUME)) {
+ if (op == GD_OP_SET_VOLUME) {
//check for set volume help
ret = dict_get_str (dict, "volname", &volname);
if (volname &&
diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c
index cf23b640478..7f798ad26de 100644
--- a/xlators/mgmt/glusterd/src/glusterd-quota.c
+++ b/xlators/mgmt/glusterd/src/glusterd-quota.c
@@ -474,7 +474,7 @@ glusterd_set_quota_limit (char *volname, char *path, char *hard_limit,
new_limit.sl = hton64 (new_limit.sl);
- ret = gf_string2bytesize (hard_limit, (uint64_t*)&new_limit.hl);
+ ret = gf_string2bytesize_uint64 (hard_limit, (uint64_t*)&new_limit.hl);
if (ret)
goto out;
@@ -1400,13 +1400,13 @@ glusterd_op_stage_quota (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
"Faild to get hard-limit from dict");
goto out;
}
- ret = gf_string2bytesize (hard_limit_str, &hard_limit);
+ ret = gf_string2bytesize_uint64 (hard_limit_str, &hard_limit);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"Failed to convert hard-limit string to value");
goto out;
}
- if (hard_limit > INT64_MAX) {
+ if (hard_limit > UINT64_MAX) {
ret = -1;
ret = gf_asprintf (op_errstr, "Hard-limit %s is greater"
" than %"PRId64"bytes. Please set a "
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index d11abee7060..b294d1bc6b2 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -18,6 +18,14 @@
#include <sys/resource.h>
#include <sys/statvfs.h>
#include <sys/mount.h>
+#include <signal.h>
+
+
+#if !defined(__NetBSD__) && !defined(GF_DARWIN_HOST_OS)
+#include <mntent.h>
+#else
+#include "mntent_compat.h"
+#endif
#include "globals.h"
#include "compat.h"
@@ -40,9 +48,7 @@
#include "cli1-xdr.h"
#include "xdr-generic.h"
-#ifdef GF_LINUX_HOST_OS
-#include <mntent.h>
-#endif
+#include "lvm-defaults.h"
char snap_mount_folder[PATH_MAX];
@@ -267,7 +273,7 @@ out:
int
snap_max_hard_limits_validate (dict_t *dict, char *volname,
- uint64_t value, char **op_errstr)
+ uint64_t value, char **op_errstr)
{
char err_str[PATH_MAX] = "";
glusterd_conf_t *conf = NULL;
@@ -449,7 +455,7 @@ glusterd_snap_create_pre_val_use_rsp_dict (dict_t *dst, dict_t *src)
for (i = 0; i < volume_count; i++) {
memset (snapbrckcnt, '\0', sizeof(snapbrckcnt));
ret = snprintf (snapbrckcnt, sizeof(snapbrckcnt) - 1,
- "vol%ld_brickcount", i+1);
+ "vol%"PRId64"_brickcount", i+1);
ret = dict_get_int64 (src, snapbrckcnt, &brick_count);
if (ret) {
gf_log (this->name, GF_LOG_TRACE,
@@ -460,7 +466,7 @@ glusterd_snap_create_pre_val_use_rsp_dict (dict_t *dst, dict_t *src)
for (j = 0; j < brick_count; j++) {
/* Fetching data from source dict */
snprintf (key, sizeof(key) - 1,
- "vol%ld.brickdir%ld", i+1, j);
+ "vol%"PRId64".brickdir%"PRId64, i+1, j);
ret = dict_get_ptr (src, key,
(void **)&snap_brick_dir);
@@ -471,7 +477,7 @@ glusterd_snap_create_pre_val_use_rsp_dict (dict_t *dst, dict_t *src)
}
snprintf (key, sizeof(key) - 1,
- "vol%ld.brick_snapdevice%ld", i+1, j);
+ "vol%"PRId64".brick_snapdevice%"PRId64, i+1, j);
ret = dict_get_ptr (src, key,
(void **)&snap_device);
@@ -482,7 +488,7 @@ glusterd_snap_create_pre_val_use_rsp_dict (dict_t *dst, dict_t *src)
}
snprintf (snapbrckord, sizeof(snapbrckord) - 1,
- "vol%ld.brick%ld.order", i+1, j);
+ "vol%"PRId64".brick%"PRId64".order", i+1, j);
ret = dict_get_int64 (src, snapbrckord, &brick_order);
if (ret) {
@@ -493,7 +499,7 @@ glusterd_snap_create_pre_val_use_rsp_dict (dict_t *dst, dict_t *src)
/* Adding the data in the dst dict */
snprintf (key, sizeof(key) - 1,
- "vol%ld.brickdir%ld", i+1, brick_order);
+ "vol%"PRId64".brickdir%"PRId64, i+1, brick_order);
tmpstr = gf_strdup (snap_brick_dir);
if (!tmpstr) {
@@ -511,7 +517,7 @@ glusterd_snap_create_pre_val_use_rsp_dict (dict_t *dst, dict_t *src)
}
snprintf (key, sizeof(key) - 1,
- "vol%ld.brick_snapdevice%ld",
+ "vol%"PRId64".brick_snapdevice%"PRId64,
i+1, brick_order);
tmpstr = gf_strdup (snap_device);
@@ -618,8 +624,8 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
goto out;
}
if (volcount <= 0) {
- snprintf (err_str, sizeof (err_str), "Invalid volume count %ld "
- "supplied", volcount);
+ snprintf (err_str, sizeof (err_str), "Invalid volume count %"PRId64
+ " supplied", volcount);
ret = -1;
goto out;
}
@@ -638,7 +644,7 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
}
for (i = 1; i <= volcount; i++) {
- snprintf (key, sizeof (key), "volname%ld", i);
+ snprintf (key, sizeof (key), "volname%"PRId64, i);
ret = dict_get_str (dict, key, &volname);
if (ret) {
snprintf (err_str, sizeof (err_str),
@@ -690,7 +696,7 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
goto out;
}
- snprintf (key, sizeof(key) - 1, "vol%ld_volid", i);
+ snprintf (key, sizeof(key) - 1, "vol%"PRId64"_volid", i);
ret = dict_get_bin (dict, key, (void **)&snap_volid);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
@@ -745,7 +751,7 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
}
snprintf (key, sizeof(key),
- "vol%ld.brick_snapdevice%ld", i,
+ "vol%"PRId64".brick_snapdevice%"PRId64, i,
brick_count);
ret = dict_set_dynstr (rsp_dict, key, device);
if (ret) {
@@ -783,7 +789,7 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
ret = -1;
goto out;
}
- snprintf (key, sizeof(key), "vol%ld.brickdir%ld", i,
+ snprintf (key, sizeof(key), "vol%"PRId64".brickdir%"PRId64, i,
brick_count);
ret = dict_set_dynstr (rsp_dict, key, tmpstr);
if (ret) {
@@ -793,7 +799,7 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
}
tmpstr = NULL;
- snprintf (key, sizeof(key) - 1, "vol%ld.brick%ld.order",
+ snprintf (key, sizeof(key) - 1, "vol%"PRId64".brick%"PRId64".order",
i, brick_count);
ret = dict_set_int64 (rsp_dict, key, brick_order);
if (ret) {
@@ -805,7 +811,7 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
brick_count++;
brick_order++;
}
- snprintf (key, sizeof(key) - 1, "vol%ld_brickcount", i);
+ snprintf (key, sizeof(key) - 1, "vol%"PRId64"_brickcount", i);
ret = dict_set_int64 (rsp_dict, key, brick_count);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to set %s",
@@ -1002,7 +1008,7 @@ glusterd_do_lvm_snapshot_remove (glusterd_volinfo_t *snap_vol,
snprintf (msg, sizeof(msg), "remove snapshot of the brick %s:%s, "
"device: %s", brickinfo->hostname, brickinfo->path,
snap_device);
- runner_add_args (&runner, "/sbin/lvremove", "-f", snap_device, NULL);
+ runner_add_args (&runner, LVM_REMOVE, "-f", snap_device, NULL);
runner_log (&runner, "", GF_LOG_DEBUG, msg);
ret = runner_run (&runner);
@@ -2047,8 +2053,8 @@ glusterd_handle_snapshot_create (rpcsvc_request_t *req, glusterd_op_t op,
goto out;
}
if (volcount <= 0) {
- gf_log (this->name, GF_LOG_ERROR, "Invalid volume count %ld "
- "supplied", volcount);
+ gf_log (this->name, GF_LOG_ERROR, "Invalid volume count %"PRId64
+ " supplied", volcount);
ret = -1;
goto out;
}
@@ -2476,7 +2482,7 @@ glusterd_create_snap_object (dict_t *dict, dict_t *rsp_dict)
}
if (time_stamp <= 0) {
ret = -1;
- gf_log (this->name, GF_LOG_ERROR, "Invalid time-stamp: %ld",
+ gf_log (this->name, GF_LOG_ERROR, "Invalid time-stamp: %"PRId64,
time_stamp);
goto out;
}
@@ -2715,7 +2721,7 @@ glusterd_take_lvm_snapshot (glusterd_volinfo_t *snap_vol,
/* Figuring out if setactivationskip flag is supported or not */
runinit (&runner);
snprintf (msg, sizeof (msg), "running lvcreate help");
- runner_add_args (&runner, "/sbin/lvcreate", "--help", NULL);
+ runner_add_args (&runner, LVM_CREATE, "--help", NULL);
runner_log (&runner, "", GF_LOG_DEBUG, msg);
runner_redir (&runner, STDOUT_FILENO, RUN_PIPE);
ret = runner_start (&runner);
@@ -2744,11 +2750,11 @@ glusterd_take_lvm_snapshot (glusterd_volinfo_t *snap_vol,
snprintf (msg, sizeof (msg), "taking snapshot of the brick %s:%s",
brickinfo->hostname, brickinfo->path);
if (match == _gf_true)
- runner_add_args (&runner, "/sbin/lvcreate", "-s", device,
+ runner_add_args (&runner, LVM_CREATE, "-s", device,
"--setactivationskip", "n", "--name",
snap_vol->volname, NULL);
else
- runner_add_args (&runner, "/sbin/lvcreate", "-s", device,
+ runner_add_args (&runner, LVM_CREATE, "-s", device,
"--name", snap_vol->volname, NULL);
runner_log (&runner, "", GF_LOG_DEBUG, msg);
ret = runner_start (&runner);
@@ -2862,7 +2868,11 @@ out:
if (ret) {
gf_log (this->name, GF_LOG_WARNING, "unmounting the snap brick"
" mount %s", snap_brick_mount_path);
+#if !defined(GF_DARWIN_HOST_OS)
umount (snap_brick_mount_path);
+#else
+ unmount (snap_brick_mount_path, 0);
+#endif
}
gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret);
@@ -2893,7 +2903,7 @@ glusterd_add_bricks_to_snap_volume (dict_t *dict, dict_t *rsp_dict,
GF_ASSERT (snap_brickinfo);
GF_ASSERT (snap_brick_dir);
- snprintf (key, sizeof(key) - 1, "vol%ld.brickdir%d", volcount,
+ snprintf (key, sizeof(key) - 1, "vol%"PRId64".brickdir%d", volcount,
brick_count);
ret = dict_get_ptr (dict, key, (void **)snap_brick_dir);
if (ret) {
@@ -2951,7 +2961,7 @@ glusterd_add_bricks_to_snap_volume (dict_t *dict, dict_t *rsp_dict,
}
}
- snprintf (key, sizeof(key), "vol%ld.brick_snapdevice%d",
+ snprintf (key, sizeof(key), "vol%"PRId64".brick_snapdevice%d",
volcount, brick_count);
ret = dict_get_ptr (dict, key, (void **)&snap_device);
if (ret) {
@@ -3129,7 +3139,7 @@ glusterd_do_snap_vol (glusterd_volinfo_t *origin_vol, glusterd_snap_t *snap,
GF_ASSERT (rsp_dict);
/* fetch username, password and vol_id from dict*/
- snprintf (key, sizeof(key), "volume%ld_username", volcount);
+ snprintf (key, sizeof(key), "volume%"PRId64"_username", volcount);
ret = dict_get_str (dict, key, &username);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to get %s for "
@@ -3137,7 +3147,7 @@ glusterd_do_snap_vol (glusterd_volinfo_t *origin_vol, glusterd_snap_t *snap,
goto out;
}
- snprintf (key, sizeof(key), "volume%ld_password", volcount);
+ snprintf (key, sizeof(key), "volume%"PRId64"_password", volcount);
ret = dict_get_str (dict, key, &password);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to get %s for "
@@ -3145,7 +3155,7 @@ glusterd_do_snap_vol (glusterd_volinfo_t *origin_vol, glusterd_snap_t *snap,
goto out;
}
- snprintf (key, sizeof(key) - 1, "vol%ld_volid", volcount);
+ snprintf (key, sizeof(key) - 1, "vol%"PRId64"_volid", volcount);
ret = dict_get_bin (dict, key, (void **)&snap_volid);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
@@ -3367,7 +3377,7 @@ glusterd_handle_snapshot_remove (rpcsvc_request_t *req, glusterd_op_t op,
goto out;
}
- snprintf (key, sizeof (key), "volname%ld", volcount);
+ snprintf (key, sizeof (key), "volname%"PRId64, volcount);
ret = dict_set_dynstr (dict, key, volname);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to set "
@@ -3771,7 +3781,7 @@ glusterd_snapshot_create_commit (dict_t *dict, char **op_errstr,
}
for (i = 1; i <= volcount; i++) {
- snprintf (key, sizeof (key), "volname%ld", i);
+ snprintf (key, sizeof (key), "volname%"PRId64, i);
ret = dict_get_str (dict, key, &volname);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
@@ -3922,7 +3932,7 @@ snap_max_limits_display_commit (dict_t *rsp_dict, char *volname,
soft_limit_value = (active_hard_limit *
conf->snap_max_soft_limit) / 100;
- snprintf (buf, sizeof(buf), "volume%ld-volname", count);
+ snprintf (buf, sizeof(buf), "volume%"PRIu64"-volname", count);
ret = dict_set_str (rsp_dict, buf, volinfo->volname);
if (ret) {
snprintf (err_str, PATH_MAX,
@@ -3931,7 +3941,7 @@ snap_max_limits_display_commit (dict_t *rsp_dict, char *volname,
}
snprintf (buf, sizeof(buf),
- "volume%ld-snap-max-hard-limit", count);
+ "volume%"PRIu64"-snap-max-hard-limit", count);
ret = dict_set_uint64 (rsp_dict, buf, snap_max_limit);
if (ret) {
snprintf (err_str, PATH_MAX,
@@ -3940,7 +3950,7 @@ snap_max_limits_display_commit (dict_t *rsp_dict, char *volname,
}
snprintf (buf, sizeof(buf),
- "volume%ld-active-hard-limit", count);
+ "volume%"PRIu64"-active-hard-limit", count);
ret = dict_set_uint64 (rsp_dict, buf,
active_hard_limit);
if (ret) {
@@ -3950,7 +3960,7 @@ snap_max_limits_display_commit (dict_t *rsp_dict, char *volname,
}
snprintf (buf, sizeof(buf),
- "volume%ld-snap-max-soft-limit", count);
+ "volume%"PRIu64"-snap-max-soft-limit", count);
ret = dict_set_uint64 (rsp_dict, buf, soft_limit_value);
if (ret) {
snprintf (err_str, PATH_MAX,
@@ -3984,7 +3994,7 @@ snap_max_limits_display_commit (dict_t *rsp_dict, char *volname,
soft_limit_value = (active_hard_limit *
conf->snap_max_soft_limit) / 100;
- snprintf (buf, sizeof(buf), "volume%ld-volname", count);
+ snprintf (buf, sizeof(buf), "volume%"PRIu64"-volname", count);
ret = dict_set_str (rsp_dict, buf, volinfo->volname);
if (ret) {
snprintf (err_str, PATH_MAX,
@@ -3993,7 +4003,7 @@ snap_max_limits_display_commit (dict_t *rsp_dict, char *volname,
}
snprintf (buf, sizeof(buf),
- "volume%ld-snap-max-hard-limit", count);
+ "volume%"PRIu64"-snap-max-hard-limit", count);
ret = dict_set_uint64 (rsp_dict, buf, snap_max_limit);
if (ret) {
snprintf (err_str, PATH_MAX,
@@ -4002,7 +4012,7 @@ snap_max_limits_display_commit (dict_t *rsp_dict, char *volname,
}
snprintf (buf, sizeof(buf),
- "volume%ld-active-hard-limit", count);
+ "volume%"PRIu64"-active-hard-limit", count);
ret = dict_set_uint64 (rsp_dict, buf, active_hard_limit);
if (ret) {
snprintf (err_str, PATH_MAX,
@@ -4011,7 +4021,7 @@ snap_max_limits_display_commit (dict_t *rsp_dict, char *volname,
}
snprintf (buf, sizeof(buf),
- "volume%ld-snap-max-soft-limit", count);
+ "volume%"PRIu64"-snap-max-soft-limit", count);
ret = dict_set_uint64 (rsp_dict, buf, soft_limit_value);
if (ret) {
snprintf (err_str, PATH_MAX,
@@ -4196,7 +4206,7 @@ glusterd_get_brick_lvm_details (dict_t *rsp_dict,
* for the above given command with separator ":",
* The output will be "vgname:lvsize"
*/
- runner_add_args (&runner, "lvs", device, "--noheading", "-o",
+ runner_add_args (&runner, LVS, device, "--noheading", "-o",
"vg_name,data_percent,lv_size",
"--separator", ":", NULL);
runner_redir (&runner, STDOUT_FILENO, RUN_PIPE);
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index e28a30c5ac4..b803ba28253 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -2615,7 +2615,7 @@ out:
return volinfo;
}
-inline void
+static inline void
glusterd_store_set_options_path (glusterd_conf_t *conf, char *path, size_t len)
{
snprintf (path, len, "%s/options", conf->workdir);
@@ -3722,7 +3722,7 @@ glusterd_store_retrieve_quota_version (glusterd_volinfo_t *volinfo)
}
version = strtoul (version_str, &tmp, 10);
- if (version < 0) {
+ if ((errno == ERANGE) || (errno == EINVAL)) {
gf_log (this->name, GF_LOG_DEBUG, "Invalid version number");
goto out;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index bb8028003ce..be2022da42d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -13,6 +13,12 @@
#endif
#include <inttypes.h>
+#if !defined(__NetBSD__) && !defined(GF_DARWIN_HOST_OS)
+#include <mntent.h>
+#else
+#include "mntent_compat.h"
+#endif
+
#include "globals.h"
#include "glusterfs.h"
#include "compat.h"
@@ -44,7 +50,6 @@
#include <inttypes.h>
#include <signal.h>
#include <sys/types.h>
-#include <net/if.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <rpc/pmap_clnt.h>
@@ -56,11 +61,6 @@
#include <lvm2app.h>
#endif
-
-#ifdef GF_LINUX_HOST_OS
-#include <mntent.h>
-#endif
-
#ifdef GF_SOLARIS_HOST_OS
#include <sys/sockio.h>
#endif
@@ -4520,14 +4520,16 @@ glusterd_nodesvc_start (char *server, gf_boolean_t wait)
"--trace-children=yes", "--track-origins=yes",
NULL);
runner_argprintf (&runner, "--log-file=%s", valgrind_logfile);
- }
+ }
runner_add_args (&runner, SBIN_DIR"/glusterfs",
"-s", "localhost",
"--volfile-id", volfileid,
"-p", pidfile,
"-l", logfile,
- "-S", sockfpath, NULL);
+ "-S", sockfpath,
+ "-L", "DEBUG",
+ NULL);
if (!strcmp (server, "glustershd")) {
snprintf (glusterd_uuid_option, sizeof (glusterd_uuid_option),
@@ -5454,7 +5456,6 @@ out:
return -1;
}
-#ifdef GF_LINUX_HOST_OS
int
glusterd_get_brick_root (char *path, char **mount_point)
{
@@ -5750,7 +5751,6 @@ out:
return device;
}
-#endif
int
glusterd_add_brick_detail_to_dict (glusterd_volinfo_t *volinfo,
@@ -5824,13 +5824,12 @@ glusterd_add_brick_detail_to_dict (glusterd_volinfo_t *volinfo,
if (ret)
goto out;
}
-#ifdef GF_LINUX_HOST_OS
+
ret = glusterd_add_brick_mount_details (brickinfo, dict, count);
if (ret)
goto out;
ret = glusterd_add_inode_size_to_dict (dict, count);
-#endif
out:
if (ret)
gf_log (this->name, GF_LOG_DEBUG, "Error adding brick"
@@ -8828,7 +8827,7 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src)
}
for (i = 0; i < voldisplaycount; i++) {
- snprintf (buf, sizeof(buf), "volume%ld-volname", i);
+ snprintf (buf, sizeof(buf), "volume%"PRIu64"-volname", i);
ret = dict_get_str (src, buf, &volname);
if (ret) {
gf_log ("", GF_LOG_ERROR,
@@ -8843,7 +8842,7 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src)
}
snprintf (buf, sizeof(buf),
- "volume%ld-snap-max-hard-limit", i);
+ "volume%"PRIu64"-snap-max-hard-limit", i);
ret = dict_get_uint64 (src, buf, &value);
if (ret) {
gf_log ("", GF_LOG_ERROR,
@@ -8858,7 +8857,7 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src)
}
snprintf (buf, sizeof(buf),
- "volume%ld-active-hard-limit", i);
+ "volume%"PRIu64"-active-hard-limit", i);
ret = dict_get_uint64 (src, buf, &value);
if (ret) {
gf_log ("", GF_LOG_ERROR,
@@ -8873,7 +8872,7 @@ glusterd_snap_config_use_rsp_dict (dict_t *dst, dict_t *src)
}
snprintf (buf, sizeof(buf),
- "volume%ld-snap-max-soft-limit", i);
+ "volume%"PRIu64"-snap-max-soft-limit", i);
ret = dict_get_uint64 (src, buf, &value);
if (ret) {
gf_log ("", GF_LOG_ERROR,
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h
index 23f8ad7f66b..d2121778a10 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.h
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.h
@@ -8,7 +8,7 @@
cases as published by the Free Software Foundation.
*/
#ifndef _GLUSTERD_UTILS_H
-#define _GLUSTERD_UTILS_H_
+#define _GLUSTERD_UTILS_H
#ifndef _CONFIG_H
#define _CONFIG_H
@@ -684,14 +684,16 @@ glusterd_rpc_clnt_unref (glusterd_conf_t *conf, rpc_clnt_t *rpc);
int32_t
glusterd_compare_volume_name(struct list_head *, struct list_head *);
-#ifdef GF_LINUX_HOST_OS
+
char*
glusterd_get_brick_mount_details (glusterd_brickinfo_t *brickinfo);
+
struct mntent *
glusterd_get_mnt_entry_info (char *mnt_pt, FILE *mtab);
+
int
glusterd_get_brick_root (char *path, char **mount_point);
-#endif //LINUX_HOST
+
int
glusterd_compare_snap_time(struct list_head *, struct list_head *);
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index ca799aefc8e..316b70f7782 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -741,7 +741,7 @@ int
glusterd_volinfo_get_boolean (glusterd_volinfo_t *volinfo, char *key)
{
char *val = NULL;
- gf_boolean_t boo = _gf_false;
+ gf_boolean_t enabled = _gf_false;
int ret = 0;
ret = glusterd_volinfo_get (volinfo, key, &val);
@@ -749,14 +749,14 @@ glusterd_volinfo_get_boolean (glusterd_volinfo_t *volinfo, char *key)
return -1;
if (val)
- ret = gf_string2boolean (val, &boo);
+ ret = gf_string2boolean (val, &enabled);
if (ret) {
gf_log ("", GF_LOG_ERROR, "value for %s option is not valid", key);
return -1;
}
- return boo;
+ return enabled;
}
gf_boolean_t
@@ -1258,8 +1258,8 @@ static int
server_check_marker_off (volgen_graph_t *graph, struct volopt_map_entry *vme,
glusterd_volinfo_t *volinfo)
{
- gf_boolean_t bool = _gf_false;
- int ret = 0;
+ gf_boolean_t enabled = _gf_false;
+ int ret = 0;
GF_ASSERT (volinfo);
GF_ASSERT (vme);
@@ -1267,8 +1267,8 @@ server_check_marker_off (volgen_graph_t *graph, struct volopt_map_entry *vme,
if (strcmp (vme->option, "!xtime") != 0)
return 0;
- ret = gf_string2boolean (vme->value, &bool);
- if (ret || bool)
+ ret = gf_string2boolean (vme->value, &enabled);
+ if (ret || enabled)
goto out;
ret = glusterd_volinfo_get_boolean (volinfo, VKEY_MARKER_XTIME);
@@ -1279,10 +1279,10 @@ server_check_marker_off (volgen_graph_t *graph, struct volopt_map_entry *vme,
}
if (ret) {
- bool = _gf_false;
- ret = glusterd_check_gsync_running (volinfo, &bool);
+ enabled = _gf_false;
+ ret = glusterd_check_gsync_running (volinfo, &enabled);
- if (bool) {
+ if (enabled) {
gf_log ("", GF_LOG_WARNING, GEOREP" sessions active"
"for the volume %s, cannot disable marker "
,volinfo->volname);
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index eac926d9533..504aeb839bc 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -1213,7 +1213,7 @@ glusterd_op_stage_delete_volume (dict_t *dict, char **op_errstr)
if (volinfo->snap_count > 0 || !list_empty(&volinfo->snap_volumes)) {
snprintf (msg, sizeof (msg), "Cannot delete Volume %s ,"
- "as it has %ld snapshots. "
+ "as it has %"PRIu64" snapshots. "
"To delete the volume, "
"first delete all the snapshots under it.",
volname, volinfo->snap_count);
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 29e9f2b877c..1c5d359d9e3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -116,8 +116,8 @@ validate_cache_max_min_size (dict_t *dict, char *key, char *value,
"performance.cache-max-file-size",
&current_max_value);
if (current_max_value) {
- gf_string2bytesize (current_max_value, &max_value);
- gf_string2bytesize (value, &min_value);
+ gf_string2bytesize_uint64 (current_max_value, &max_value);
+ gf_string2bytesize_uint64 (value, &min_value);
current_min_value = value;
}
} else if ((!strcmp (key, "performance.cache-max-file-size")) ||
@@ -126,8 +126,8 @@ validate_cache_max_min_size (dict_t *dict, char *key, char *value,
"performance.cache-min-file-size",
&current_min_value);
if (current_min_value) {
- gf_string2bytesize (current_min_value, &min_value);
- gf_string2bytesize (value, &max_value);
+ gf_string2bytesize_uint64 (current_min_value, &min_value);
+ gf_string2bytesize_uint64 (value, &max_value);
current_max_value = value;
}
}
@@ -1370,6 +1370,18 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.type = GLOBAL_DOC,
.op_version = 1
},
+ { .key = "nfs.rpc-statd",
+ .voltype = "nfs/server",
+ .option = "nfs.rpc-statd",
+ .type = NO_DOC,
+ .op_version = 4,
+ },
+ { .key = "nfs.log-level",
+ .voltype = "nfs/server",
+ .option = "nfs.log-level",
+ .type = NO_DOC,
+ .op_version = 4,
+ },
{ .key = "nfs.server-aux-gids",
.voltype = "nfs/server",
.option = "nfs.server-aux-gids",
@@ -1434,6 +1446,10 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.voltype = "storage/posix",
.op_version = 3
},
+ { .key = "storage.xattr-user-namespace-mode",
+ .voltype = "storage/posix",
+ .op_version = 4
+ },
{ .key = "storage.owner-uid",
.voltype = "storage/posix",
.option = "brick-uid",
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index 85a6b920adf..abef538d8f0 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -30,6 +30,7 @@
#include "dict.h"
#include "compat.h"
#include "compat-errno.h"
+#include "syscall.h"
#include "statedump.h"
#include "glusterd-sm.h"
#include "glusterd-op-sm.h"
@@ -311,7 +312,7 @@ out:
}
-inline int32_t
+static inline int32_t
glusterd_program_register (xlator_t *this, rpcsvc_t *svc,
rpcsvc_program_t *prog)
{
@@ -804,7 +805,7 @@ check_prepare_mountbroker_root (char *mountbroker_root)
dfd0 = dup (dfd);
for (;;) {
- ret = openat (dfd, "..", O_RDONLY);
+ ret = sys_openat (dfd, "..", O_RDONLY);
if (ret != -1) {
dfd2 = ret;
ret = fstat (dfd2, &st2);
@@ -839,11 +840,11 @@ check_prepare_mountbroker_root (char *mountbroker_root)
st = st2;
}
- ret = mkdirat (dfd0, MB_HIVE, 0711);
+ ret = sys_mkdirat (dfd0, MB_HIVE, 0711);
if (ret == -1 && errno == EEXIST)
ret = 0;
if (ret != -1)
- ret = fstatat (dfd0, MB_HIVE, &st, AT_SYMLINK_NOFOLLOW);
+ ret = sys_fstatat (dfd0, MB_HIVE, &st, AT_SYMLINK_NOFOLLOW);
if (ret == -1 || st.st_mode != (S_IFDIR|0711)) {
gf_log ("", GF_LOG_ERROR,
"failed to set up mountbroker-root directory %s",