|
|
e3c68b |
From b1a4947e382c5e2ba1137ed606ecffc69fcf00e9 Mon Sep 17 00:00:00 2001
|
|
|
e3c68b |
From: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
e3c68b |
Date: Tue, 25 Jun 2019 17:30:17 +0530
|
|
|
e3c68b |
Subject: [PATCH 205/221] glusterd: Can't run rebalance due to long unix socket
|
|
|
e3c68b |
|
|
|
e3c68b |
Problem: glusterd populate unix socket file name based
|
|
|
e3c68b |
on volname and if volname is lengthy socket
|
|
|
e3c68b |
system call's are failed due to breach maximum length
|
|
|
e3c68b |
is defined in the kernel.
|
|
|
e3c68b |
|
|
|
e3c68b |
Solution:Convert unix socket name to hash to resolve the issue
|
|
|
e3c68b |
|
|
|
e3c68b |
> Change-Id: I5072e8184013095587537dbfa4767286307fff65
|
|
|
e3c68b |
> fixes: bz#1720566
|
|
|
e3c68b |
> (Cherry pick from commit 2d7b77eb971700c1073db2b74f5877c1ae8293fc)
|
|
|
e3c68b |
> (Reviewed on upstream link https://review.gluster.org/#/c/glusterfs/+/22869/)
|
|
|
e3c68b |
|
|
|
e3c68b |
BUG: 1720192
|
|
|
e3c68b |
Change-Id: I5072e8184013095587537dbfa4767286307fff65
|
|
|
e3c68b |
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
e3c68b |
Reviewed-on: https://code.engineering.redhat.com/gerrit/174557
|
|
|
e3c68b |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
e3c68b |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
e3c68b |
---
|
|
|
e3c68b |
tests/bugs/glusterd/bug-1720566.t | 50 ++++++++++++++++++++++++++
|
|
|
e3c68b |
xlators/mgmt/glusterd/src/glusterd-rebalance.c | 38 +-------------------
|
|
|
e3c68b |
xlators/mgmt/glusterd/src/glusterd.h | 23 +++++-------
|
|
|
e3c68b |
3 files changed, 59 insertions(+), 52 deletions(-)
|
|
|
e3c68b |
create mode 100644 tests/bugs/glusterd/bug-1720566.t
|
|
|
e3c68b |
|
|
|
e3c68b |
diff --git a/tests/bugs/glusterd/bug-1720566.t b/tests/bugs/glusterd/bug-1720566.t
|
|
|
e3c68b |
new file mode 100644
|
|
|
e3c68b |
index 0000000..99bcf6f
|
|
|
e3c68b |
--- /dev/null
|
|
|
e3c68b |
+++ b/tests/bugs/glusterd/bug-1720566.t
|
|
|
e3c68b |
@@ -0,0 +1,50 @@
|
|
|
e3c68b |
+#!/bin/bash
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+. $(dirname $0)/../../include.rc
|
|
|
e3c68b |
+. $(dirname $0)/../../cluster.rc
|
|
|
e3c68b |
+. $(dirname $0)/../../volume.rc
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+cleanup;
|
|
|
e3c68b |
+V0="TestLongVolnamec363b7b536700ff06eedeae0dd9037fec363b7b536700ff06eedeae0dd9037fec363b7b536700ff06eedeae0dd9abcd"
|
|
|
e3c68b |
+V1="TestLongVolname3102bd28a16c49440bd5210e4ec4d5d93102bd28a16c49440bd5210e4ec4d5d933102bd28a16c49440bd5210e4ebbcd"
|
|
|
e3c68b |
+TEST launch_cluster 2;
|
|
|
e3c68b |
+TEST $CLI_1 peer probe $H2;
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+$CLI_1 volume create $V0 $H1:$B1/$V0 $H2:$B2/$V0
|
|
|
e3c68b |
+EXPECT 'Created' cluster_volinfo_field 1 $V0 'Status';
|
|
|
e3c68b |
+$CLI_1 volume create $V1 $H1:$B1/$V1 $H2:$B2/$V1
|
|
|
e3c68b |
+EXPECT 'Created' cluster_volinfo_field 1 $V1 'Status';
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+$CLI_1 volume start $V0
|
|
|
e3c68b |
+EXPECT 'Started' cluster_volinfo_field 1 $V0 'Status';
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+$CLI_1 volume start $V1
|
|
|
e3c68b |
+EXPECT 'Started' cluster_volinfo_field 1 $V1 'Status';
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Mount FUSE
|
|
|
e3c68b |
+TEST glusterfs -s $H1 --volfile-id=$V0 $M0;
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Mount FUSE
|
|
|
e3c68b |
+TEST glusterfs -s $H1 --volfile-id=$V1 $M1;
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST mkdir $M0/dir{1..4};
|
|
|
e3c68b |
+TEST touch $M0/dir{1..4}/files{1..4};
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST mkdir $M1/dir{1..4};
|
|
|
e3c68b |
+TEST touch $M1/dir{1..4}/files{1..4};
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST $CLI_1 volume add-brick $V0 $H1:$B1/${V0}_1 $H2:$B2/${V0}_1
|
|
|
e3c68b |
+TEST $CLI_1 volume add-brick $V1 $H1:$B1/${V1}_1 $H2:$B2/${V1}_1
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST $CLI_1 volume rebalance $V0 start
|
|
|
e3c68b |
+TEST $CLI_1 volume rebalance $V1 start
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $REBALANCE_TIMEOUT "completed" cluster_rebalance_status_field 1 $V0
|
|
|
e3c68b |
+EXPECT_WITHIN $REBALANCE_TIMEOUT "completed" cluster_rebalance_status_field 1 $V1
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+cleanup;
|
|
|
e3c68b |
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
|
|
|
e3c68b |
index cbed9a9..b419a89 100644
|
|
|
e3c68b |
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
|
|
|
e3c68b |
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
|
|
|
e3c68b |
@@ -266,18 +266,7 @@ glusterd_handle_defrag_start(glusterd_volinfo_t *volinfo, char *op_errstr,
|
|
|
e3c68b |
|
|
|
e3c68b |
if (dict_get_strn(this->options, "transport.socket.bind-address",
|
|
|
e3c68b |
SLEN("transport.socket.bind-address"),
|
|
|
e3c68b |
- &volfileserver) == 0) {
|
|
|
e3c68b |
- /*In the case of running multiple glusterds on a single machine,
|
|
|
e3c68b |
- *we should ensure that log file and unix socket file should be
|
|
|
e3c68b |
- *unique in given cluster */
|
|
|
e3c68b |
-
|
|
|
e3c68b |
- GLUSTERD_GET_DEFRAG_SOCK_FILE_OLD(sockfile, volinfo, priv);
|
|
|
e3c68b |
- snprintf(logfile, PATH_MAX, "%s/%s-%s-%s.log",
|
|
|
e3c68b |
- DEFAULT_LOG_FILE_DIRECTORY, volinfo->volname,
|
|
|
e3c68b |
- (cmd == GF_DEFRAG_CMD_START_TIER ? "tier" : "rebalance"),
|
|
|
e3c68b |
- uuid_utoa(MY_UUID));
|
|
|
e3c68b |
-
|
|
|
e3c68b |
- } else {
|
|
|
e3c68b |
+ &volfileserver) != 0) {
|
|
|
e3c68b |
volfileserver = "localhost";
|
|
|
e3c68b |
}
|
|
|
e3c68b |
|
|
|
e3c68b |
@@ -378,9 +367,6 @@ glusterd_rebalance_rpc_create(glusterd_volinfo_t *volinfo)
|
|
|
e3c68b |
glusterd_defrag_info_t *defrag = volinfo->rebal.defrag;
|
|
|
e3c68b |
glusterd_conf_t *priv = NULL;
|
|
|
e3c68b |
xlator_t *this = NULL;
|
|
|
e3c68b |
- struct stat buf = {
|
|
|
e3c68b |
- 0,
|
|
|
e3c68b |
- };
|
|
|
e3c68b |
|
|
|
e3c68b |
this = THIS;
|
|
|
e3c68b |
GF_ASSERT(this);
|
|
|
e3c68b |
@@ -396,28 +382,6 @@ glusterd_rebalance_rpc_create(glusterd_volinfo_t *volinfo)
|
|
|
e3c68b |
goto out;
|
|
|
e3c68b |
|
|
|
e3c68b |
GLUSTERD_GET_DEFRAG_SOCK_FILE(sockfile, volinfo);
|
|
|
e3c68b |
- /* Check if defrag sockfile exists in the new location
|
|
|
e3c68b |
- * in /var/run/ , if it does not try the old location
|
|
|
e3c68b |
- */
|
|
|
e3c68b |
- ret = sys_stat(sockfile, &buf;;
|
|
|
e3c68b |
- /* TODO: Remove this once we don't need backward compatibility
|
|
|
e3c68b |
- * with the older path
|
|
|
e3c68b |
- */
|
|
|
e3c68b |
- if (ret && (errno == ENOENT)) {
|
|
|
e3c68b |
- gf_msg(this->name, GF_LOG_WARNING, errno, GD_MSG_FILE_OP_FAILED,
|
|
|
e3c68b |
- "Rebalance sockfile "
|
|
|
e3c68b |
- "%s does not exist. Trying old path.",
|
|
|
e3c68b |
- sockfile);
|
|
|
e3c68b |
- GLUSTERD_GET_DEFRAG_SOCK_FILE_OLD(sockfile, volinfo, priv);
|
|
|
e3c68b |
- ret = sys_stat(sockfile, &buf;;
|
|
|
e3c68b |
- if (ret && (ENOENT == errno)) {
|
|
|
e3c68b |
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_REBAL_NO_SOCK_FILE,
|
|
|
e3c68b |
- "Rebalance "
|
|
|
e3c68b |
- "sockfile %s does not exist",
|
|
|
e3c68b |
- sockfile);
|
|
|
e3c68b |
- goto out;
|
|
|
e3c68b |
- }
|
|
|
e3c68b |
- }
|
|
|
e3c68b |
|
|
|
e3c68b |
/* Setting frame-timeout to 10mins (600seconds).
|
|
|
e3c68b |
* Unix domain sockets ensures that the connection is reliable. The
|
|
|
e3c68b |
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
e3c68b |
index f96bca3..7d07d33 100644
|
|
|
e3c68b |
--- a/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
e3c68b |
+++ b/xlators/mgmt/glusterd/src/glusterd.h
|
|
|
e3c68b |
@@ -910,30 +910,23 @@ typedef ssize_t (*gd_serialize_t)(struct iovec outmsg, void *args);
|
|
|
e3c68b |
} \
|
|
|
e3c68b |
} while (0)
|
|
|
e3c68b |
|
|
|
e3c68b |
-#define GLUSTERD_GET_DEFRAG_SOCK_FILE_OLD(path, volinfo, priv) \
|
|
|
e3c68b |
- do { \
|
|
|
e3c68b |
- char defrag_path[PATH_MAX]; \
|
|
|
e3c68b |
- int32_t _sockfile_old_len; \
|
|
|
e3c68b |
- GLUSTERD_GET_DEFRAG_DIR(defrag_path, volinfo, priv); \
|
|
|
e3c68b |
- _sockfile_old_len = snprintf(path, PATH_MAX, "%s/%s.sock", \
|
|
|
e3c68b |
- defrag_path, uuid_utoa(MY_UUID)); \
|
|
|
e3c68b |
- if ((_sockfile_old_len < 0) || (_sockfile_old_len >= PATH_MAX)) { \
|
|
|
e3c68b |
- path[0] = 0; \
|
|
|
e3c68b |
- } \
|
|
|
e3c68b |
- } while (0)
|
|
|
e3c68b |
-
|
|
|
e3c68b |
#define GLUSTERD_GET_DEFRAG_SOCK_FILE(path, volinfo) \
|
|
|
e3c68b |
do { \
|
|
|
e3c68b |
char operation[NAME_MAX]; \
|
|
|
e3c68b |
+ char tmppath[PATH_MAX] = { \
|
|
|
e3c68b |
+ 0, \
|
|
|
e3c68b |
+ }; \
|
|
|
e3c68b |
int32_t _defrag_sockfile_len; \
|
|
|
e3c68b |
GLUSTERD_GET_DEFRAG_PROCESS(operation, volinfo); \
|
|
|
e3c68b |
_defrag_sockfile_len = snprintf( \
|
|
|
e3c68b |
- path, UNIX_PATH_MAX, \
|
|
|
e3c68b |
- DEFAULT_VAR_RUN_DIRECTORY "/gluster-%s-%s.sock", operation, \
|
|
|
e3c68b |
- uuid_utoa(volinfo->volume_id)); \
|
|
|
e3c68b |
+ tmppath, PATH_MAX, \
|
|
|
e3c68b |
+ DEFAULT_VAR_RUN_DIRECTORY "/gluster-%s-%s-%s.sock", operation, \
|
|
|
e3c68b |
+ volinfo->volname, uuid_utoa(MY_UUID)); \
|
|
|
e3c68b |
if ((_defrag_sockfile_len < 0) || \
|
|
|
e3c68b |
(_defrag_sockfile_len >= PATH_MAX)) { \
|
|
|
e3c68b |
path[0] = 0; \
|
|
|
e3c68b |
+ } else { \
|
|
|
e3c68b |
+ glusterd_set_socket_filepath(tmppath, path, sizeof(path)); \
|
|
|
e3c68b |
} \
|
|
|
e3c68b |
} while (0)
|
|
|
e3c68b |
|
|
|
e3c68b |
--
|
|
|
e3c68b |
1.8.3.1
|
|
|
e3c68b |
|