autobuild v3.12.2-16

Resolves: bz#1569657 bz#1608352 bz#1609163 bz#1609724 bz#1610825
Resolves: bz#1611151 bz#1612098 bz#1615338 bz#1615440
Signed-off-by: Milind Changire <mchangir@redhat.com>
This commit is contained in:
Milind Changire 2018-08-14 13:37:41 -04:00
parent 299302574e
commit c459b4cbb4
19 changed files with 1945 additions and 1 deletions

View File

@ -0,0 +1,127 @@
From e849b8d24e97b7e8e9f0bd0ab7d49c748a5897fa Mon Sep 17 00:00:00 2001
From: Sanju Rakonde <srakonde@redhat.com>
Date: Wed, 1 Aug 2018 15:09:08 +0530
Subject: [PATCH 334/351] glusterd: Bricks of a normal volumes should not
attach to gluster_shared_storage bricks
Problem: In a brick multiplexing environment, Bricks of a normal volume
created by user are getting attached to the bricks of a volume
"gluster_shared_storage" which is created by enabling the
enable-shared-storage option. Mounting gluster_shared_storage
has strict authentication checks. when we attach bricks of a normal
volume to bricks of gluster_shared_storage, mounting the normal
volume created by user will fail due to strict authentication checks.
Solution: We should not attach bricks of a normal volume to brick
process of gluster_shared_storage volume and vice versa.
>fixes: bz#1610726
>Change-Id: If1b5a2a02675789a2915ba480fb48c145449163d
>Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
upstream patch: https://review.gluster.org/#/c/20604/
Change-Id: If1b5a2a02675789a2915ba480fb48c145449163d
BUG: 1609163
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/146221
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
.../glusterd/brick-mux-validation-in-cluster.t | 51 ++++++++++++++++++++++
xlators/mgmt/glusterd/src/glusterd-utils.c | 14 ++++++
2 files changed, 65 insertions(+)
create mode 100644 tests/bugs/glusterd/brick-mux-validation-in-cluster.t
diff --git a/tests/bugs/glusterd/brick-mux-validation-in-cluster.t b/tests/bugs/glusterd/brick-mux-validation-in-cluster.t
new file mode 100644
index 0000000..4e57038
--- /dev/null
+++ b/tests/bugs/glusterd/brick-mux-validation-in-cluster.t
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../cluster.rc
+
+function count_brick_processes {
+ pgrep glusterfsd | wc -l
+}
+
+cleanup;
+
+TEST launch_cluster 3
+TEST $CLI_1 peer probe $H2;
+EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count
+
+TEST $CLI_1 peer probe $H3;
+EXPECT_WITHIN $PROBE_TIMEOUT 2 peer_count
+
+TEST $CLI_1 volume set all cluster.brick-multiplex on
+#bug-1609163 - bricks of normal volume should not attach to bricks of gluster_shared_storage volume
+
+##Create, start and mount meta_volume i.e., shared_storage
+TEST $CLI_1 volume create $META_VOL replica 3 $H1:$B1/${META_VOL}1 $H2:$B2/${META_VOL}1 $H3:$B3/${META_VOL}1
+TEST $CLI_1 volume start $META_VOL
+TEST mkdir -p $META_MNT
+TEST glusterfs -s $H1 --volfile-id $META_VOL $META_MNT
+
+TEST $CLI_1 volume info gluster_shared_storage
+
+EXPECT 3 count_brick_processes
+
+#create and start a new volume
+TEST $CLI_1 volume create $V0 replica 3 $H1:$B1/${V0}{1..3} $H2:$B2/${V0}{1..3}
+TEST $CLI_1 volume start $V0
+
+# bricks of normal volume should not attach to bricks of gluster_shared_storage volume
+EXPECT 5 count_brick_processes
+
+#bug-1549996 - stale brick processes on the nodes after volume deletion
+
+TEST $CLI_1 volume create $V1 replica 3 $H1:$B1/${V1}{1..3} $H2:$B2/${V1}{1..3}
+TEST $CLI_1 volume start $V1
+
+EXPECT 5 count_brick_processes
+
+TEST $CLI_1 volume stop $V0
+TEST $CLI_1 volume stop $V1
+
+EXPECT 3 count_brick_processes
+
+cleanup
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index fe9cc75..80204e4 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -5710,6 +5710,7 @@ find_compat_brick_in_vol (glusterd_conf_t *conf,
int mux_limit = -1;
int ret = -1;
gf_boolean_t brick_status = _gf_false;
+ gf_boolean_t is_shared_storage = _gf_false;
/*
* If comp_vol is provided, we have to check *volume* compatibility
@@ -5717,6 +5718,19 @@ find_compat_brick_in_vol (glusterd_conf_t *conf,
*/
if (comp_vol) {
/*
+ * We should not attach bricks of a normal volume to bricks
+ * of shared storage volume.
+ */
+ if (!strcmp (srch_vol->volname, GLUSTER_SHARED_STORAGE))
+ is_shared_storage = _gf_true;
+
+ if (!strcmp (comp_vol->volname, GLUSTER_SHARED_STORAGE)) {
+ if (!is_shared_storage)
+ return NULL;
+ } else if (is_shared_storage)
+ return NULL;
+
+ /*
* It's kind of a shame that we have to do this check in both
* directions, but an option might only exist on one of the two
* dictionaries and dict_foreach_match will only find that one.
--
1.8.3.1

View File

@ -0,0 +1,44 @@
From 9408859ce233c84f94fe4b7dd73cbbdc09fac10c Mon Sep 17 00:00:00 2001
From: Ashish Pandey <aspandey@redhat.com>
Date: Thu, 2 Aug 2018 10:54:52 +0530
Subject: [PATCH 335/351] cluster/ec: set others.eager-lock option off by
default
This patch is only for downstream.
We will revert the changes back to ON once we take
lock contention feature for downstream, which is already present
in upstream.
Change-Id: I4619eb692fe66732d5373dd63afd28b44467027a
BUG: 1611151
Signed-off-by: Ashish Pandey <aspandey@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/145842
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
xlators/cluster/ec/src/ec.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/xlators/cluster/ec/src/ec.c b/xlators/cluster/ec/src/ec.c
index 0d59efd..9a23a45 100644
--- a/xlators/cluster/ec/src/ec.c
+++ b/xlators/cluster/ec/src/ec.c
@@ -1434,9 +1434,13 @@ struct volume_options options[] =
"disabled, lock will be released as soon as fop "
"completes."
},
+ /* Keeping this option OFF by default. Once we take lock
+ * contention notification feature (upstream patch #14736) in for
+ * downstream we can revert this to ON.
+ */
{ .key = {"other-eager-lock"},
.type = GF_OPTION_TYPE_BOOL,
- .default_value = "on",
+ .default_value = "off",
.description = "It's equivalent to the eager-lock option but for non "
"regular files."
},
--
1.8.3.1

View File

@ -0,0 +1,34 @@
From 1aa17a84422024a4941843474b58f78827b9d2c9 Mon Sep 17 00:00:00 2001
From: Amar Tumballi <amarts@redhat.com>
Date: Tue, 24 Jul 2018 13:25:12 +0530
Subject: [PATCH 336/351] dict: handle negative key/value length while
unserialize
BUG: 1607407
Change-Id: Ie56df0da46c242846a1ba51ccb9e011af118b119
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/145895
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: Atin Mukherjee <amukherj@redhat.com>
---
libglusterfs/src/dict.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libglusterfs/src/dict.c b/libglusterfs/src/dict.c
index 36d91a7..40458ca 100644
--- a/libglusterfs/src/dict.c
+++ b/libglusterfs/src/dict.c
@@ -3003,7 +3003,8 @@ dict_unserialize (char *orig_buf, int32_t size, dict_t **fill)
vallen = ntoh32 (hostord);
buf += DICT_DATA_HDR_VAL_LEN;
- if ((buf + keylen) > (orig_buf + size)) {
+ if ((keylen < 0) || (vallen < 0) ||
+ (buf + keylen) > (orig_buf + size)) {
gf_msg_callingfn ("dict", GF_LOG_ERROR, 0,
LG_MSG_UNDERSIZED_BUF,
"undersized buffer passed. "
--
1.8.3.1

View File

@ -0,0 +1,64 @@
From d339013984f117159217f48908c517ba32ed278c Mon Sep 17 00:00:00 2001
From: Mohit Agrawal <moagrawa@redhat.com>
Date: Sat, 30 Jun 2018 19:51:34 +0530
Subject: [PATCH 337/351] glusterfs: Brick process is crash at the time of call
server_first_lookup
Problem: Brick process is getting crash while executing test case
tests/bugs/core/bug-1432542-mpx-restart-crash.t
Solution: At the time of initiating connection with brick process by
client brick process call server_setvolume.If cleanup thread
has set cleanup_starting flag after check flag by server_setvolume
then a brick process can crash at the time of calling lookup
on brick root.To avoid crash check cleanup_starting
flag before just call server_first_lookup
> BUG: 1597627
> Change-Id: I12542c124c76429184df34a04c1eae1a30052ca7
> fixes: bz#1597627
> Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
> Note: To test the patch executing test case
> tests/bugs/core/bug-1432542-mpx-restart-crash.t in a loop
> around 100 times
> (Cherry picked from commit dab12ce093628860bf43c3e0c7eaf9099cf7a78f)
> (Reviewed on upstream link https://review.gluster.org/#/c/20427/)
Change-Id: I490d8152e82e254163a2938f75ab0d2f64bc58b4
BUG: 1609724
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/146227
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
xlators/protocol/server/src/server-handshake.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c
index a59bcda..12f620c 100644
--- a/xlators/protocol/server/src/server-handshake.c
+++ b/xlators/protocol/server/src/server-handshake.c
@@ -910,9 +910,17 @@ fail:
to client. Very important in case of subdirectory mounts, where if
client is trying to mount a non-existing directory */
if (op_ret >= 0 && client->bound_xl->itable) {
- op_ret = server_first_lookup (this, client, reply);
- if (op_ret == -1)
- op_errno = ENOENT;
+ if (client->bound_xl->cleanup_starting) {
+ op_ret = -1;
+ op_errno = EAGAIN;
+ ret = dict_set_str (reply, "ERROR",
+ "cleanup flag is set for xlator "
+ "before call first_lookup Try again later");
+ } else {
+ op_ret = server_first_lookup (this, client, reply);
+ if (op_ret == -1)
+ op_errno = ENOENT;
+ }
}
rsp = GF_CALLOC (1, sizeof (gf_setvolume_rsp),
--
1.8.3.1

View File

@ -0,0 +1,67 @@
From 9656e92cfcd3db351c149e78ca36a4f3cf4c37f3 Mon Sep 17 00:00:00 2001
From: Amar Tumballi <amarts@redhat.com>
Date: Fri, 10 Aug 2018 15:28:35 +0530
Subject: [PATCH 338/351] posix: prevent crash when SEEK_DATA/HOLE is not
supported
Instead of not defining the 'seek' fop when it's not supported on the
compilation platform, we simply return EINVAL when it's used.
Upstream reference:
> URL: https://review.gluster.org/20625
> Fixes: bz#1611834
> Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
BUG: 1610825
Change-Id: I253666d8910c5e2fffa3a3ba37085e5c1c058a8e
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/146682
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
xlators/storage/posix/src/posix.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index c3b7120..5203068 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -1184,11 +1184,11 @@ posix_ipc (call_frame_t *frame, xlator_t *this, int32_t op, dict_t *xdata)
}
-#ifdef HAVE_SEEK_HOLE
static int32_t
posix_seek (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
gf_seek_what_t what, dict_t *xdata)
{
+#ifdef HAVE_SEEK_HOLE
struct posix_fd *pfd = NULL;
off_t ret = -1;
int err = 0;
@@ -1236,9 +1236,11 @@ out:
STACK_UNWIND_STRICT (seek, frame, (ret == -1 ? -1 : 0), err,
(ret == -1 ? -1 : ret), xdata);
+#else
+ STACK_UNWIND_STRICT (seek, frame, -1, EINVAL, 0, NULL);
+#endif
return 0;
}
-#endif
int32_t
posix_opendir (call_frame_t *frame, xlator_t *this,
@@ -8018,9 +8020,7 @@ struct xlator_fops fops = {
.discard = posix_discard,
.zerofill = posix_zerofill,
.ipc = posix_ipc,
-#ifdef HAVE_SEEK_HOLE
.seek = posix_seek,
-#endif
.lease = posix_lease,
};
--
1.8.3.1

View File

@ -0,0 +1,283 @@
From 54c7d29635ee284c0390260d4bececf917397bc7 Mon Sep 17 00:00:00 2001
From: Amar Tumballi <amarts@redhat.com>
Date: Thu, 2 Aug 2018 14:25:38 +0530
Subject: [PATCH 339/351] posix: remove not supported get/set content
getting and setting a file's content using extended
attribute worked great as a GET/PUT alternative when
an object storage is supported on top of Gluster. But
it needs application changes, and also, it skips some
caching layers. It is not used over years, and not
supported any more. Remove the dead code.
BUG: 1608363
BUG: 1608366
Change-Id: I6d4c135ca1bce5197c7cf749f9f3b481b91f2a95
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/145896
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Reviewed-by: FNU Raghavendra Manjunath <raghavendra@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
libglusterfs/src/glusterfs.h | 6 --
xlators/storage/posix/src/posix-helpers.c | 165 +-----------------------------
xlators/storage/posix/src/posix.c | 13 ---
xlators/storage/posix/src/posix.h | 4 -
4 files changed, 1 insertion(+), 187 deletions(-)
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index b161bf0..d71a9c1 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -185,9 +185,6 @@ enum gf_internal_fop_indicator {
#define DHT_CHANGELOG_RENAME_OP_KEY "changelog.rename-op"
-#define ZR_FILE_CONTENT_STR "glusterfs.file."
-#define ZR_FILE_CONTENT_STRLEN 15
-
#define GLUSTERFS_WRITE_IS_APPEND "glusterfs.write-is-append"
#define GLUSTERFS_WRITE_UPDATE_ATOMIC "glusterfs.write-update-atomic"
#define GLUSTERFS_OPEN_FD_COUNT "glusterfs.open-fd-count"
@@ -254,9 +251,6 @@ enum gf_internal_fop_indicator {
#define STARTING_EVENT_THREADS 1
-#define ZR_FILE_CONTENT_REQUEST(key) (!strncmp(key, ZR_FILE_CONTENT_STR, \
- ZR_FILE_CONTENT_STRLEN))
-
#define DEFAULT_VAR_RUN_DIRECTORY DATADIR "/run/gluster"
#define DEFAULT_GLUSTERFSD_MISC_DIRETORY DATADIR "/lib/misc/glusterfsd"
#ifdef GF_LINUX_HOST_OS
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
index 49f9f46..cddf02e 100644
--- a/xlators/storage/posix/src/posix-helpers.c
+++ b/xlators/storage/posix/src/posix-helpers.c
@@ -919,165 +919,6 @@ out:
}
-int
-posix_set_file_contents (xlator_t *this, const char *path, char *keyp,
- data_t *value, int flags)
-{
- char * key = NULL;
- char real_path[PATH_MAX];
- int32_t file_fd = -1;
- int op_ret = 0;
- int ret = -1;
-
-
- /* XXX: does not handle assigning GFID to created files */
- return -1;
-
- key = &(keyp[15]);
- sprintf (real_path, "%s/%s", path, key);
-
- if (flags & XATTR_REPLACE) {
- /* if file exists, replace it
- * else, error out */
- file_fd = open (real_path, O_TRUNC|O_WRONLY);
-
- if (file_fd == -1) {
- goto create;
- }
-
- if (value->len) {
- ret = sys_write (file_fd, value->data, value->len);
- if (ret == -1) {
- op_ret = -errno;
- gf_msg (this->name, GF_LOG_ERROR, errno,
- P_MSG_SET_FILE_CONTENTS, "write failed"
- "while doing setxattr for key %s on"
- "path%s", key, real_path);
- goto out;
- }
-
- ret = sys_close (file_fd);
- if (ret == -1) {
- op_ret = -errno;
- gf_msg (this->name, GF_LOG_ERROR, errno,
- P_MSG_SET_FILE_CONTENTS,
- "close failed on %s",
- real_path);
- goto out;
- }
- }
-
- create: /* we know file doesn't exist, create it */
-
- file_fd = open (real_path, O_CREAT|O_WRONLY, 0644);
-
- if (file_fd == -1) {
- op_ret = -errno;
- gf_msg (this->name, GF_LOG_ERROR, errno,
- P_MSG_SET_FILE_CONTENTS, "failed to open file"
- "%s with O_CREAT", key);
- goto out;
- }
-
- ret = sys_write (file_fd, value->data, value->len);
- if (ret == -1) {
- op_ret = -errno;
- gf_msg (this->name, GF_LOG_ERROR, errno,
- P_MSG_SET_FILE_CONTENTS, "write failed on %s"
- "while setxattr with key %s", real_path, key);
- goto out;
- }
-
- ret = sys_close (file_fd);
- if (ret == -1) {
- op_ret = -errno;
- gf_msg (this->name, GF_LOG_ERROR, errno,
- P_MSG_SET_FILE_CONTENTS, "close failed on"
- " %s while setxattr with key %s",
- real_path, key);
- goto out;
- }
- }
-
-out:
- return op_ret;
-}
-
-
-int
-posix_get_file_contents (xlator_t *this, uuid_t pargfid,
- const char *name, char **contents)
-{
- char *real_path = NULL;
- int32_t file_fd = -1;
- struct iatt stbuf = {0,};
- int op_ret = 0;
- int ret = -1;
-
-
- MAKE_HANDLE_PATH (real_path, this, pargfid, name);
- if (!real_path) {
- op_ret = -ESTALE;
- gf_msg (this->name, GF_LOG_ERROR, ESTALE,
- P_MSG_XDATA_GETXATTR,
- "Failed to create handle path for %s/%s",
- uuid_utoa (pargfid), name);
- goto out;
- }
-
- op_ret = posix_istat (this, pargfid, name, &stbuf);
- if (op_ret == -1) {
- op_ret = -errno;
- gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_XDATA_GETXATTR,
- "lstat failed on %s", real_path);
- goto out;
- }
-
- file_fd = open (real_path, O_RDONLY);
-
- if (file_fd == -1) {
- op_ret = -errno;
- gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_XDATA_GETXATTR,
- "open failed on %s", real_path);
- goto out;
- }
-
- *contents = GF_CALLOC (stbuf.ia_size + 1, sizeof(char),
- gf_posix_mt_char);
- if (! *contents) {
- op_ret = -errno;
- goto out;
- }
-
- ret = sys_read (file_fd, *contents, stbuf.ia_size);
- if (ret <= 0) {
- op_ret = -1;
- gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_XDATA_GETXATTR,
- "read on %s failed", real_path);
- goto out;
- }
-
- *contents[stbuf.ia_size] = '\0';
-
- op_ret = sys_close (file_fd);
- file_fd = -1;
- if (op_ret == -1) {
- op_ret = -errno;
- gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_XDATA_GETXATTR,
- "close on %s failed", real_path);
- goto out;
- }
-
-out:
- if (op_ret < 0) {
- GF_FREE (*contents);
- if (file_fd != -1)
- sys_close (file_fd);
- }
-
- return op_ret;
-}
-
#ifdef HAVE_SYS_ACL_H
int
posix_pacl_set (const char *path, const char *key, const char *acl_s)
@@ -1190,9 +1031,6 @@ posix_handle_pair (xlator_t *this, const char *real_path,
} else if (posix_is_gfid2path_xattr (key)) {
ret = -ENOTSUP;
goto out;
- } else if (ZR_FILE_CONTENT_REQUEST(key)) {
- ret = posix_set_file_contents (this, real_path, key, value,
- flags);
} else if (GF_POSIX_ACL_REQUEST (key)) {
if (stbuf && IS_DHT_LINKFILE_MODE (stbuf))
goto out;
@@ -1635,8 +1473,7 @@ _handle_entry_create_keyvalue_pair (dict_t *d, char *k, data_t *v,
!strcmp ("gfid-req", k) ||
!strcmp (POSIX_ACL_DEFAULT_XATTR, k) ||
!strcmp (POSIX_ACL_ACCESS_XATTR, k) ||
- posix_xattr_ignorable (k) ||
- ZR_FILE_CONTENT_REQUEST(k)) {
+ posix_xattr_ignorable (k)) {
return 0;
}
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 5203068..5c6e103 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -4720,19 +4720,6 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
goto out;
}
- if (loc->inode && IA_ISDIR(loc->inode->ia_type) && name &&
- ZR_FILE_CONTENT_REQUEST(name)) {
- ret = posix_get_file_contents (this, loc->gfid, &name[15],
- &file_contents);
- if (ret < 0) {
- op_errno = -ret;
- gf_msg (this->name, GF_LOG_ERROR, op_errno,
- P_MSG_FILE_FAILED, "getting file contents"
- "failed");
- goto out;
- }
- }
-
dict = dict_new ();
if (!dict) {
op_errno = ENOMEM;
diff --git a/xlators/storage/posix/src/posix.h b/xlators/storage/posix/src/posix.h
index 8e40e6f..eaf4d0d 100644
--- a/xlators/storage/posix/src/posix.h
+++ b/xlators/storage/posix/src/posix.h
@@ -304,10 +304,6 @@ int posix_handle_pair (xlator_t *this, const char *real_path, char *key,
int posix_fhandle_pair (xlator_t *this, int fd, char *key, data_t *value,
int flags, struct iatt *stbuf);
void posix_spawn_janitor_thread (xlator_t *this);
-int posix_get_file_contents (xlator_t *this, uuid_t pargfid,
- const char *name, char **contents);
-int posix_set_file_contents (xlator_t *this, const char *path, char *key,
- data_t *value, int flags);
int posix_acl_xattr_set (xlator_t *this, const char *path, dict_t *xattr_req);
int posix_gfid_heal (xlator_t *this, const char *path, loc_t *loc, dict_t *xattr_req);
int posix_entry_create_xattr_set (xlator_t *this, const char *path,
--
1.8.3.1

View File

@ -0,0 +1,396 @@
From d15e6e4443e8873dc44c6731ce8876bde625b189 Mon Sep 17 00:00:00 2001
From: Amar Tumballi <amarts@redhat.com>
Date: Thu, 2 Aug 2018 14:27:45 +0530
Subject: [PATCH 340/351] protocol: don't use alloca
current implementation of alloca can cause issues when strings larger
than the allocated buffer is passed to the xdr. Hence it makes sense
to allow XDR decode functions to deal with memory allocations, which
we can free later.
BUG: 1605227
Change-Id: I12d1c5d5498d0a403abd9c4e618bd5b4b60df8ee
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/145897
Reviewed-by: FNU Raghavendra Manjunath <raghavendra@redhat.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/protocol/server/src/server-rpc-fops.c | 74 ++++++++++-----------------
1 file changed, 27 insertions(+), 47 deletions(-)
diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c
index 0bf41d8..a7fd3b5 100644
--- a/xlators/protocol/server/src/server-rpc-fops.c
+++ b/xlators/protocol/server/src/server-rpc-fops.c
@@ -3896,8 +3896,6 @@ server3_3_create (rpcsvc_request_t *req)
if (!req)
return ret;
- args.bname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_create_req, GF_FOP_CREATE);
if (ret != 0) {
@@ -3931,6 +3929,7 @@ server3_3_create (rpcsvc_request_t *req)
out:
/* memory allocated by libc, don't use GF_FREE */
free (args.xdata.xdata_val);
+ free (args.bname);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4453,8 +4452,6 @@ server3_3_unlink (rpcsvc_request_t *req)
if (!req)
return ret;
- args.bname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_unlink_req, GF_FOP_UNLINK);
if (ret != 0) {
@@ -4479,6 +4476,7 @@ server3_3_unlink (rpcsvc_request_t *req)
resolve_and_resume (frame, server_unlink_resume);
out:
free (args.xdata.xdata_val);
+ free (args.bname);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4500,8 +4498,6 @@ server3_3_setxattr (rpcsvc_request_t *req)
if (!req)
return ret;
- args.dict.dict_val = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_setxattr_req, GF_FOP_SETXATTR);
if (ret != 0) {
@@ -4537,6 +4533,7 @@ server3_3_setxattr (rpcsvc_request_t *req)
out:
free (args.xdata.xdata_val);
+ free (args.dict.dict_val);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4562,8 +4559,6 @@ server3_3_fsetxattr (rpcsvc_request_t *req)
if (!req)
return ret;
- args.dict.dict_val = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_fsetxattr_req, GF_FOP_FSETXATTR);
if (ret != 0) {
@@ -4597,6 +4592,7 @@ server3_3_fsetxattr (rpcsvc_request_t *req)
out:
free (args.xdata.xdata_val);
+ free (args.dict.dict_val);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4622,8 +4618,6 @@ server3_3_fxattrop (rpcsvc_request_t *req)
if (!req)
return ret;
- args.dict.dict_val = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_fxattrop_req, GF_FOP_FXATTROP);
if (ret != 0) {
@@ -4657,6 +4651,7 @@ server3_3_fxattrop (rpcsvc_request_t *req)
out:
free (args.xdata.xdata_val);
+ free (args.dict.dict_val);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4682,8 +4677,6 @@ server3_3_xattrop (rpcsvc_request_t *req)
if (!req)
return ret;
- args.dict.dict_val = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_xattrop_req, GF_FOP_XATTROP);
if (ret != 0) {
@@ -4716,6 +4709,7 @@ server3_3_xattrop (rpcsvc_request_t *req)
out:
free (args.xdata.xdata_val);
+ free (args.dict.dict_val);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4739,8 +4733,6 @@ server3_3_getxattr (rpcsvc_request_t *req)
if (!req)
return ret;
- args.name = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_getxattr_req, GF_FOP_GETXATTR);
if (ret != 0) {
@@ -4766,6 +4758,7 @@ server3_3_getxattr (rpcsvc_request_t *req)
resolve_and_resume (frame, server_getxattr_resume);
out:
free (args.xdata.xdata_val);
+ free (args.name);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4786,8 +4779,6 @@ server3_3_fgetxattr (rpcsvc_request_t *req)
if (!req)
return ret;
- args.name = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_fgetxattr_req, GF_FOP_FGETXATTR);
if (ret != 0) {
@@ -4810,6 +4801,7 @@ server3_3_fgetxattr (rpcsvc_request_t *req)
resolve_and_resume (frame, server_fgetxattr_resume);
out:
free (args.xdata.xdata_val);
+ free (args.name);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4831,8 +4823,6 @@ server3_3_removexattr (rpcsvc_request_t *req)
if (!req)
return ret;
- args.name = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_removexattr_req,
GF_FOP_REMOVEXATTR);
@@ -4854,6 +4844,7 @@ server3_3_removexattr (rpcsvc_request_t *req)
resolve_and_resume (frame, server_removexattr_resume);
out:
free (args.xdata.xdata_val);
+ free (args.name);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -4873,8 +4864,6 @@ server3_3_fremovexattr (rpcsvc_request_t *req)
if (!req)
return ret;
- args.name = alloca (4096);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_fremovexattr_req,
GF_FOP_FREMOVEXATTR);
@@ -4897,6 +4886,7 @@ server3_3_fremovexattr (rpcsvc_request_t *req)
resolve_and_resume (frame, server_fremovexattr_resume);
out:
free (args.xdata.xdata_val);
+ free (args.name);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -5107,8 +5097,6 @@ server3_3_mknod (rpcsvc_request_t *req)
if (!req)
return ret;
- args.bname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_mknod_req, GF_FOP_MKNOD);
if (ret != 0) {
@@ -5140,6 +5128,7 @@ out:
/* memory allocated by libc, don't use GF_FREE */
free (args.xdata.xdata_val);
+ free (args.bname);
return ret;
@@ -5158,8 +5147,6 @@ server3_3_mkdir (rpcsvc_request_t *req)
if (!req)
return ret;
- args.bname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_mkdir_req, GF_FOP_MKDIR);
if (ret != 0) {
@@ -5189,6 +5176,7 @@ out:
SERVER_REQ_SET_ERROR (req, ret);
free (args.xdata.xdata_val);
+ free (args.bname);
return ret;
}
@@ -5206,8 +5194,6 @@ server3_3_rmdir (rpcsvc_request_t *req)
if (!req)
return ret;
- args.bname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_rmdir_req, GF_FOP_RMDIR);
if (ret != 0) {
@@ -5231,6 +5217,7 @@ server3_3_rmdir (rpcsvc_request_t *req)
resolve_and_resume (frame, server_rmdir_resume);
out:
free (args.xdata.xdata_val);
+ free (args.bname);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -5253,8 +5240,6 @@ server3_3_inodelk (rpcsvc_request_t *req)
if (!req)
return ret;
- args.volume = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_inodelk_req, GF_FOP_INODELK);
if (ret != 0) {
@@ -5304,6 +5289,7 @@ server3_3_inodelk (rpcsvc_request_t *req)
resolve_and_resume (frame, server_inodelk_resume);
out:
free (args.xdata.xdata_val);
+ free (args.volume);
free (args.flock.lk_owner.lk_owner_val);
@@ -5325,8 +5311,6 @@ server3_3_finodelk (rpcsvc_request_t *req)
if (!req)
return ret;
- args.volume = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_finodelk_req,
GF_FOP_FINODELK);
@@ -5378,6 +5362,7 @@ server3_3_finodelk (rpcsvc_request_t *req)
resolve_and_resume (frame, server_finodelk_resume);
out:
free (args.xdata.xdata_val);
+ free (args.volume);
free (args.flock.lk_owner.lk_owner_val);
@@ -5400,9 +5385,6 @@ server3_3_entrylk (rpcsvc_request_t *req)
if (!req)
return ret;
- args.volume = alloca (256);
- args.name = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_entrylk_req,
GF_FOP_ENTRYLK);
@@ -5430,6 +5412,8 @@ server3_3_entrylk (rpcsvc_request_t *req)
resolve_and_resume (frame, server_entrylk_resume);
out:
free (args.xdata.xdata_val);
+ free (args.volume);
+ free (args.name);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -5449,9 +5433,6 @@ server3_3_fentrylk (rpcsvc_request_t *req)
if (!req)
return ret;
- args.name = alloca (256);
- args.volume = alloca (256);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_fentrylk_req,
GF_FOP_FENTRYLK);
@@ -5479,6 +5460,8 @@ server3_3_fentrylk (rpcsvc_request_t *req)
resolve_and_resume (frame, server_fentrylk_resume);
out:
free (args.xdata.xdata_val);
+ free (args.volume);
+ free (args.name);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -5539,9 +5522,6 @@ server3_3_symlink (rpcsvc_request_t *req)
if (!req)
return ret;
- args.bname = alloca (req->msg[0].iov_len);
- args.linkname = alloca (4096);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_symlink_req, GF_FOP_SYMLINK);
if (ret != 0) {
@@ -5570,6 +5550,8 @@ out:
/* memory allocated by libc, don't use GF_FREE */
free (args.xdata.xdata_val);
+ free (args.linkname);
+ free (args.bname);
return ret;
}
@@ -5588,8 +5570,6 @@ server3_3_link (rpcsvc_request_t *req)
if (!req)
return ret;
- args.newbname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_link_req, GF_FOP_LINK);
if (ret != 0) {
@@ -5614,6 +5594,7 @@ server3_3_link (rpcsvc_request_t *req)
resolve_and_resume (frame, server_link_resume);
out:
free (args.xdata.xdata_val);
+ free (args.newbname);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -5634,9 +5615,6 @@ server3_3_rename (rpcsvc_request_t *req)
if (!req)
return ret;
- args.oldbname = alloca (req->msg[0].iov_len);
- args.newbname = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_rename_req, GF_FOP_RENAME);
if (ret != 0) {
@@ -5663,6 +5641,8 @@ server3_3_rename (rpcsvc_request_t *req)
resolve_and_resume (frame, server_rename_resume);
out:
free (args.xdata.xdata_val);
+ free (args.newbname);
+ free (args.oldbname);
if (op_errno)
SERVER_REQ_SET_ERROR (req, ret);
@@ -5865,9 +5845,6 @@ server3_3_lookup (rpcsvc_request_t *req)
GF_VALIDATE_OR_GOTO ("server", req, err);
- args.bname = alloca (req->msg[0].iov_len);
- args.xdata.xdata_val = alloca (req->msg[0].iov_len);
-
ret = rpc_receive_common (req, &frame, &state, NULL, &args,
xdr_gfs3_lookup_req, GF_FOP_LOOKUP);
if (ret != 0) {
@@ -5896,6 +5873,9 @@ server3_3_lookup (rpcsvc_request_t *req)
return ret;
out:
+ free (args.bname);
+ free (args.xdata.xdata_val);
+
server_lookup_cbk (frame, NULL, frame->this, -1, EINVAL, NULL, NULL,
NULL, NULL);
ret = 0;
--
1.8.3.1

View File

@ -0,0 +1,96 @@
From bc7cc384c82ba8c0bc083ff70b5f2506acfd2b43 Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Mon, 13 Aug 2018 20:30:04 +0530
Subject: [PATCH 341/351] Revert "glusterd: enable brick multiplexing by
default"
This reverts commit 2a80ccb39ea7f4ef5c801ad78b43e4bdc23a3c64.
brick multiplexing at stand alone RHGS has been decided to be turned
off.
Label: DOWNSTREAM ONLY
BUG: 1615440
Change-Id: Iaf8bd8a637ec16c66952ef8947e835174279c9a2
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/146881
Reviewed-by: Mohit Agrawal <moagrawa@redhat.com>
---
cli/src/cli-cmd-parser.c | 18 ++++++++++++++++++
xlators/mgmt/glusterd/src/glusterd-op-sm.c | 2 +-
xlators/mgmt/glusterd/src/glusterd-utils.c | 2 +-
xlators/mgmt/glusterd/src/glusterd-volume-set.c | 2 +-
4 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index e071b7d..7917d66 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -1739,6 +1739,24 @@ cli_cmd_volume_set_parse (struct cli_state *state, const char **words,
goto out;
}
}
+
+ if ((strcmp (key, "cluster.brick-multiplex") == 0)) {
+ question = "Brick-multiplexing is supported only for "
+ "container workloads (CNS/CRS). Also it is "
+ "advised to make sure that either all "
+ "volumes are in stopped state or no bricks "
+ "are running before this option is modified."
+ "Do you still want to continue?";
+
+ answer = cli_cmd_get_confirmation (state, question);
+ if (GF_ANSWER_NO == answer) {
+ gf_log ("cli", GF_LOG_ERROR, "Operation "
+ "cancelled, exiting");
+ *op_errstr = gf_strdup ("Aborted by user.");
+ ret = -1;
+ goto out;
+ }
+ }
}
ret = dict_set_int32 (dict, "count", wordcount-3);
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index d022532..6dfd819 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -78,7 +78,7 @@ glusterd_all_vol_opts valid_all_vol_opts[] = {
* TBD: add a dynamic handler to set the appropriate value
*/
{ GLUSTERD_MAX_OP_VERSION_KEY, "BUG_NO_MAX_OP_VERSION"},
- { GLUSTERD_BRICK_MULTIPLEX_KEY, "enable"},
+ { GLUSTERD_BRICK_MULTIPLEX_KEY, "disable"},
/* Set this value to 0 by default implying brick-multiplexing
* behaviour with no limit set on the number of brick instances that
* can be attached per process.
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 80204e4..372d5f4 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -111,7 +111,7 @@ is_brick_mx_enabled (void)
if (!ret)
ret = gf_string2boolean (value, &enabled);
- return ret ? _gf_true : enabled;
+ return ret ? _gf_false : enabled;
}
int
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 8cc756a..474587a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -3506,7 +3506,7 @@ struct volopt_map_entry glusterd_volopt_map[] = {
/* Brick multiplexing options */
{ .key = GLUSTERD_BRICK_MULTIPLEX_KEY,
.voltype = "mgmt/glusterd",
- .value = "on",
+ .value = "off",
.op_version = GD_OP_VERSION_3_10_0,
.validate_fn = validate_boolean,
.type = GLOBAL_DOC,
--
1.8.3.1

View File

@ -0,0 +1,137 @@
From 16b5177ca40cb5f8b37ea5331003ecc7dbb6d992 Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Tue, 7 Aug 2018 10:25:49 +0530
Subject: [PATCH 342/351] glusterd: more stricter checks of if brick is running
in multiplex mode
While gf_attach () utility can help in detaching a brick instance from
the brick process which the kill_brick () function in tests/volume.rc
uses it has a caveat which is as follows:
1. It doesn't ensure the respective brick is marked as stopped which
glusterd does from glusterd_brick_stop
2. Sometimes if kill_brick () is executed just after a brick stack is
up, the mgmt_rpc_notify () can take some time before marking
priv->connected to 1 and before it if kill_brick () is executed, brick
will fail to initiate the pmap_signout which would inturn cleans up the
pidfile.
To avoid such possibilities, a more stricter check on if a brick is
running or not in brick multiplexing has been brought in now where it
not only checks for its pid's existance but checks if the respective
process has the brick instance associated with it before checking for
brick's status.
> Change-Id: I98b92df949076663b9686add7aab4ec2f24ad5ab
> Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
> (cherry pick from commit bb9b8f61501cc633e585593de4d9f2fe5494d5ce)
> (Reviewed on upstream link https://review.gluster.org/#/c/glusterfs/+/20651/)
Change-Id: I47b70927c839ca4828a0499006b5c1f604d3d6a4
BUG: 1612098
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/146874
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-utils.c | 71 ++++++++++++++++--------------
1 file changed, 39 insertions(+), 32 deletions(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 372d5f4..6f7c787 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -6083,6 +6083,7 @@ glusterd_brick_start (glusterd_volinfo_t *volinfo,
char *brickpath = NULL;
glusterd_volinfo_t *other_vol;
struct statvfs brickstat = {0,};
+ gf_boolean_t is_service_running = _gf_false;
this = THIS;
GF_ASSERT (this);
@@ -6149,8 +6150,39 @@ glusterd_brick_start (glusterd_volinfo_t *volinfo,
brickinfo->path);
goto out;
}
-
- if (gf_is_service_running (pidfile, &pid)) {
+ is_service_running = gf_is_service_running (pidfile, &pid);
+ if (is_service_running) {
+ if (is_brick_mx_enabled ()) {
+ brickpath = search_brick_path_from_proc
+ (pid, brickinfo->path);
+ if (!brickpath) {
+ gf_log (this->name, GF_LOG_INFO,
+ "Either pid %d is not running or brick"
+ " path %s is not consumed so cleanup pidfile",
+ pid, brickinfo->path);
+ /* brick isn't running,so unlink stale pidfile
+ * if any.
+ */
+ if (sys_access (pidfile , R_OK) == 0) {
+ sys_unlink (pidfile);
+ }
+ goto run;
+ }
+ GF_FREE (brickpath);
+ ret = glusterd_get_sock_from_brick_pid (pid, socketpath,
+ sizeof(socketpath));
+ if (ret) {
+ gf_log (this->name, GF_LOG_INFO,
+ "Either pid %d is not running or does "
+ "not match with any running brick "
+ "processes", pid);
+ /* Fetch unix socket is failed so unlink pidfile */
+ if (sys_access (pidfile , R_OK) == 0) {
+ sys_unlink (pidfile);
+ }
+ goto run;
+ }
+ }
if (brickinfo->status != GF_BRICK_STARTING &&
brickinfo->status != GF_BRICK_STARTED) {
gf_log (this->name, GF_LOG_INFO,
@@ -6168,36 +6200,11 @@ glusterd_brick_start (glusterd_volinfo_t *volinfo,
* same port (on another brick) and re-use that.
* TBD: re-use RPC connection across bricks
*/
- if (is_brick_mx_enabled ()) {
- brickpath = search_brick_path_from_proc (pid, brickinfo->path);
- if (!brickpath) {
- gf_log (this->name, GF_LOG_INFO,
- "Either pid %d is not running or brick"
- " path %s is not consumed so cleanup pidfile",
- pid, brickinfo->path);
- /* search brick is failed so unlink pidfile */
- if (sys_access (pidfile , R_OK) == 0) {
- sys_unlink (pidfile);
- }
- goto run;
- }
- GF_FREE (brickpath);
- ret = glusterd_get_sock_from_brick_pid (pid, socketpath,
- sizeof(socketpath));
- if (ret) {
- gf_log (this->name, GF_LOG_INFO,
- "Either pid %d is not running or is not match"
- " with any running brick process ", pid);
- /* Fetch unix socket is failed so unlink pidfile */
- if (sys_access (pidfile , R_OK) == 0) {
- sys_unlink (pidfile);
- }
- goto run;
- }
- } else {
- glusterd_set_brick_socket_filepath (volinfo, brickinfo,
- socketpath,
- sizeof (socketpath));
+ if (!is_brick_mx_enabled ()) {
+ glusterd_set_brick_socket_filepath
+ (volinfo, brickinfo,
+ socketpath,
+ sizeof (socketpath));
}
gf_log (this->name, GF_LOG_DEBUG,
"Using %s as sockfile for brick %s of volume %s ",
--
1.8.3.1

View File

@ -0,0 +1,46 @@
From aea891fe38aa75329b84952db2a8aad0e5536cea Mon Sep 17 00:00:00 2001
From: Mohit Agrawal <moagrawal@redhat.com>
Date: Wed, 8 Aug 2018 08:17:28 +0530
Subject: [PATCH 343/351] core: Update condition in get_xlator_by_name_or_type
Problem: Sometimes client connection is failed after throwing
error "cleanup flag is set for xlator Try again later".
The situation comes only after get a detach request but
the brick stack is not completely detached and at the same time
the client initiates a connection with brick
Solution: To resolve the same check cleanup_starting flag in get
xlator_by_name_or_type, this function call by server_setvolume
to attach a client with brick.
> Change-Id: I3720e42642fe495dd05211e2ed2cb976db9e231b
> fixes: bz#1614124
> (cherry pick from commit a6900e829484435c5bd5d8efe38490cab54ac442)
> (Reviewed on upstream link https://review.gluster.org/#/c/glusterfs/+/20657/)
Change-Id: Id51823148b519f42f762ef716a6434eb2b5f2ffc
BUG: 1608352
Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/146848
Tested-by: Mohit Agrawal <moagrawa@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
libglusterfs/src/xlator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 4722800..1cf4a63 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -424,7 +424,7 @@ get_xlator_by_name_or_type (xlator_t *this, char *target, int is_name)
for (trav = this->children; trav; trav = trav->next) {
value = is_name ? trav->xlator->name : trav->xlator->type;
- if (!strcmp(value, target)) {
+ if (!strcmp(value, target) && !trav->xlator->cleanup_starting) {
return trav->xlator;
}
child_xl = get_xlator_by_name_or_type (trav->xlator, target,
--
1.8.3.1

View File

@ -0,0 +1,151 @@
From 4c7460554f2f7c6515b77e70c878fc15d3813237 Mon Sep 17 00:00:00 2001
From: Mohit Agrawal <moagrawal@redhat.com>
Date: Sat, 4 Aug 2018 12:05:03 +0530
Subject: [PATCH 344/351] glusterd: Compare volume_id before start/attach a
brick
Problem: After reboot a node brick is not coming up because
fsid comparison is failed before start a brick
Solution: Instead of comparing fsid compare volume_id to
resolve the same because fsid is changed after
reboot a node but volume_id persist as a xattr
on brick_root path at the time of creating a volume.
> Change-Id: Ic289aab1b4ebfd83bbcae8438fee26ae61a0fff4
> fixes: bz#1612418
> (Cherry pick from commit bd8fc26a278697c30537d879ea5402db7ebab577)
> (Reviwed on upstream link https://review.gluster.org/#/c/glusterfs/+/20638/)
Change-Id: Ia183c1d67af662584debcb301171c35be5ac0d9d
BUG: 1612098
Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/146835
Tested-by: Mohit Agrawal <moagrawa@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
tests/{basic => bugs/glusterd}/bug-1595320.t | 9 +++---
xlators/mgmt/glusterd/src/glusterd-utils.c | 47 ++++++++++++++++------------
2 files changed, 32 insertions(+), 24 deletions(-)
rename tests/{basic => bugs/glusterd}/bug-1595320.t (94%)
diff --git a/tests/basic/bug-1595320.t b/tests/bugs/glusterd/bug-1595320.t
similarity index 94%
rename from tests/basic/bug-1595320.t
rename to tests/bugs/glusterd/bug-1595320.t
index 9d856ee..f41df9d 100644
--- a/tests/basic/bug-1595320.t
+++ b/tests/bugs/glusterd/bug-1595320.t
@@ -1,8 +1,8 @@
#!/bin/bash
-. $(dirname $0)/../include.rc
-. $(dirname $0)/../volume.rc
-. $(dirname $0)/../snapshot.rc
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+. $(dirname $0)/../../snapshot.rc
cleanup
@@ -52,7 +52,7 @@ EXPECT 0 count_brick_processes
# Unmount 3rd brick root from node
brick_root=$L3
-TEST umount -l $brick_root 2>/dev/null
+_umount_lv 3
# Start the volume only 2 brick should be start
TEST $CLI volume start $V0 force
@@ -70,6 +70,7 @@ n=`ls -lrth /proc/$brick_pid/fd | grep -iw $L3 | grep -v ".glusterfs" | wc -l`
TEST [ $n -eq 0 ]
# Mount the brick root
+TEST mkdir -p $brick_root
TEST mount -t xfs -o nouuid /dev/test_vg_3/brick_lvm $brick_root
# Replace brick_pid file to test brick_attach code
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 6f7c787..1752425 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -5439,6 +5439,12 @@ attach_brick_callback (struct rpc_req *req, struct iovec *iov, int count,
frame->local = NULL;
frame->cookie = NULL;
+ if (!iov) {
+ gf_log (frame->this->name, GF_LOG_ERROR, "iov is NULL");
+ ret = -1;
+ goto out;
+ }
+
ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_getspec_rsp);
if (ret < 0) {
gf_log (frame->this->name, GF_LOG_ERROR, "XDR decoding error");
@@ -6073,17 +6079,19 @@ glusterd_brick_start (glusterd_volinfo_t *volinfo,
gf_boolean_t wait,
gf_boolean_t only_connect)
{
- int ret = -1;
+ int ret = -1;
xlator_t *this = NULL;
glusterd_brickinfo_t *other_brick;
glusterd_conf_t *conf = NULL;
- int32_t pid = -1;
- char pidfile[PATH_MAX] = {0};
- char socketpath[PATH_MAX] = {0};
- char *brickpath = NULL;
+ int32_t pid = -1;
+ char pidfile[PATH_MAX] = {0};
+ char socketpath[PATH_MAX] = {0};
+ char *brickpath = NULL;
glusterd_volinfo_t *other_vol;
- struct statvfs brickstat = {0,};
gf_boolean_t is_service_running = _gf_false;
+ uuid_t volid = {0,};
+ ssize_t size = -1;
+
this = THIS;
GF_ASSERT (this);
@@ -6130,24 +6138,23 @@ glusterd_brick_start (glusterd_volinfo_t *volinfo,
GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo, brickinfo, conf);
- ret = sys_statvfs (brickinfo->path, &brickstat);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR,
- errno, GD_MSG_BRICKINFO_CREATE_FAIL,
- "failed to get statfs() call on brick %s",
- brickinfo->path);
+ /* Compare volume-id xattr is helpful to ensure the existence of a brick_root
+ path before the start/attach a brick
+ */
+ size = sys_lgetxattr (brickinfo->path, GF_XATTR_VOL_ID_KEY, volid, 16);
+ if (size != 16) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Missing %s extended attribute on brick root (%s),"
+ " brick is deemed not to be a part of the volume (%s) ",
+ GF_XATTR_VOL_ID_KEY, brickinfo->path, volinfo->volname);
goto out;
}
- /* Compare fsid is helpful to ensure the existence of a brick_root
- path before the start/attach a brick
- */
- if (brickinfo->statfs_fsid &&
- (brickinfo->statfs_fsid != brickstat.f_fsid)) {
+ if (strncmp (uuid_utoa (volinfo->volume_id), uuid_utoa(volid), GF_UUID_BUF_SIZE)) {
gf_log (this->name, GF_LOG_ERROR,
- "fsid comparison is failed it means Brick root path"
- " %s is not created by glusterd, start/attach will also fail",
- brickinfo->path);
+ "Mismatching %s extended attribute on brick root (%s),"
+ " brick is deemed not to be a part of the volume (%s)",
+ GF_XATTR_VOL_ID_KEY, brickinfo->path, volinfo->volname);
goto out;
}
is_service_running = gf_is_service_running (pidfile, &pid);
--
1.8.3.1

View File

@ -0,0 +1,126 @@
From 37132b4ea02a57056a426e04e77defb28e447ff9 Mon Sep 17 00:00:00 2001
From: Amar Tumballi <amarts@redhat.com>
Date: Tue, 24 Jul 2018 15:42:28 +0530
Subject: [PATCH 345/351] io-stats: allow only relative path for dumping
io-stats info
It wouldn't make sense to allow iostats file to be written in
*any* directory. While the formating makes sure we try to append
io-stats-name for the file, so overwriting existing file is slim,
it makes sense to restrict dumping to one directory.
BUG: 1605086
Change-Id: Ie28b6a355de574d8d3855c8654d6756ef0389055
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/145898
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
tests/bugs/core/io-stats-1322825.t | 12 ++++++------
xlators/debug/io-stats/src/io-stats.c | 29 ++++++++++++++++++++++-------
2 files changed, 28 insertions(+), 13 deletions(-)
diff --git a/tests/bugs/core/io-stats-1322825.t b/tests/bugs/core/io-stats-1322825.t
index d232ecb..53f2d04 100755
--- a/tests/bugs/core/io-stats-1322825.t
+++ b/tests/bugs/core/io-stats-1322825.t
@@ -23,7 +23,7 @@ TEST $CLI volume profile $V0 start
TEST mkdir $M0/dir1
# Generate the stat dump across the io-stat instances
-TEST setfattr -n trusted.io-stats-dump -v /tmp/io-stats-1322825 $M0
+TEST setfattr -n trusted.io-stats-dump -v io-stats-1322825 $M0
# Check if $M0 is clean w.r.t xattr information
# TODO: if there are better ways to check we really get no attr error, please
@@ -42,12 +42,12 @@ ret=$(echo $?)
EXPECT 0 echo $ret
# Check if we have 5 io-stat files in /tmp
-EXPECT 5 ls -1 /tmp/io-stats-1322825*
+EXPECT 5 ls -1 /var/run/gluster/io-stats-1322825*
# Cleanup the 5 generated files
-rm -f /tmp/io-stats-1322825*
+rm -f /var/run/gluster/io-stats-1322825*
# Rinse and repeat above for a directory
-TEST setfattr -n trusted.io-stats-dump -v /tmp/io-stats-1322825 $M0/dir1
+TEST setfattr -n trusted.io-stats-dump -v io-stats-1322825 $M0/dir1
getfattr -n trusted.io-stats-dump $B0/${V0}1/dir1 2>&1 | grep -qi "no such attribute"
ret=$(echo $?)
EXPECT 0 echo $ret
@@ -61,7 +61,7 @@ getfattr -n trusted.io-stats-dump $B0/${V0}4/dir1 2>&1 | grep -qi "no such attri
ret=$(echo $?)
EXPECT 0 echo $ret
-EXPECT 5 ls -1 /tmp/io-stats-1322825*
-rm -f /tmp/io-stats-1322825*
+EXPECT 5 ls -1 /var/run/gluster/io-stats-1322825*
+rm -f /var/run/gluster/io-stats-1322825*
cleanup;
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index f46474b..868890f 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -45,6 +45,8 @@
#define DEFAULT_GRP_BUF_SZ 16384
#define IOS_BLOCK_COUNT_SIZE 32
+#define IOS_STATS_DUMP_DIR DEFAULT_VAR_RUN_DIRECTORY
+
typedef enum {
IOS_STATS_TYPE_NONE,
IOS_STATS_TYPE_OPEN,
@@ -3000,7 +3002,6 @@ io_stats_fsync (call_frame_t *frame, xlator_t *this,
return 0;
}
-
int
conditional_dump (dict_t *dict, char *key, data_t *value, void *data)
{
@@ -3016,6 +3017,7 @@ conditional_dump (dict_t *dict, char *key, data_t *value, void *data)
int pid, namelen;
char dump_key[100];
char *slash_ptr = NULL;
+ char *path_in_value = NULL;
stub = data;
this = stub->this;
@@ -3024,13 +3026,26 @@ conditional_dump (dict_t *dict, char *key, data_t *value, void *data)
name as well. This helps when there is more than a single io-stats
instance in the graph, or the client and server processes are running
on the same node */
- /* hmmm... no check for this */
- /* name format: <passed in path/filename>.<xlator name slashes to -> */
- namelen = value->len + strlen (this->name) + 2; /* '.' and '\0' */
+ /* For the sanity of where the file should be located, we should make
+ sure file is written only inside RUNDIR (ie, /var/run/gluster) */
+ /* TODO: provide an option to dump it to different directory of
+ choice, based on options */
+ /* name format: /var/run/gluster/<passed in path/filename>.<xlator name slashes to -> */
+
+ path_in_value = data_to_str (value);
+
+ if (strstr (path_in_value, "../")) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "%s: no \"../\" allowed in path", path_in_value);
+ return -1;
+ }
+ namelen = (strlen (IOS_STATS_DUMP_DIR) + value->len +
+ strlen (this->name) + 2); /* '.' and '\0' */
+
filename = alloca0 (namelen);
- memcpy (filename, data_to_str (value), value->len);
- memcpy (filename + value->len, ".", 1);
- memcpy (filename + value->len + 1, this->name, strlen(this->name));
+
+ snprintf (filename, namelen, "%s%s.%s", IOS_STATS_DUMP_DIR,
+ path_in_value, this->name);
/* convert any slashes to '-' so that fopen works correctly */
slash_ptr = strchr (filename + value->len + 1, '/');
--
1.8.3.1

View File

@ -0,0 +1,67 @@
From 2489f91d395740b42f21322744ab64427e94a683 Mon Sep 17 00:00:00 2001
From: Jiffin Tony Thottan <jthottan@redhat.com>
Date: Tue, 31 Jul 2018 14:52:51 +0530
Subject: [PATCH 346/351] gfapi : Handle the path == "" glfs_resolve_at
Currently there is no check for path = "" in glfs_resolve_at.
So if application sends an empty path, then the function resolves
into the parent inode which is incorrect. Plus modified possible
of "path" with "origpath" in the same function.
Upstream reference
>Change-Id: Ie5ff9ce4b771607b7dbb3fe00704fe670421792a
>fixes: bz#1610236
>Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
>link : https://review.gluster.org/#/c/glusterfs/+/20594/
Change-Id: Ie5ff9ce4b771607b7dbb3fe00704fe670421792a
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/146938
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
api/src/glfs-resolve.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/api/src/glfs-resolve.c b/api/src/glfs-resolve.c
index 76835cb..95fe67a 100644
--- a/api/src/glfs-resolve.c
+++ b/api/src/glfs-resolve.c
@@ -472,14 +472,13 @@ priv_glfs_resolve_at (struct glfs *fs, xlator_t *subvol, inode_t *at,
DECLARE_OLD_THIS;
__GLFS_ENTRY_VALIDATE_FS(fs, invalid_fs);
- path = gf_strdup (origpath);
- if (!path) {
- errno = ENOMEM;
- return -1;
- }
+ if (origpath[0] == '\0') {
+ errno = EINVAL;
+ goto invalid_fs;
+ }
parent = NULL;
- if (at && path[0] != '/') {
+ if (at && origpath[0] != '/') {
/* A relative resolution of a path which starts with '/'
is equal to an absolute path resolution.
*/
@@ -487,10 +486,14 @@ priv_glfs_resolve_at (struct glfs *fs, xlator_t *subvol, inode_t *at,
} else {
inode = inode_ref (subvol->itable->root);
- if (strcmp (path, "/") == 0)
+ if (strcmp (origpath, "/") == 0)
glfs_resolve_root (fs, subvol, inode, &ciatt);
}
+ path = gf_strdup (origpath);
+ if (!path)
+ goto invalid_fs;
+
for (component = strtok_r (path, "/", &saveptr);
component; component = next_component) {
--
1.8.3.1

View File

@ -0,0 +1,30 @@
From bb613405be0392269bb661e6f24338c2c664d21d Mon Sep 17 00:00:00 2001
From: Amar Tumballi <amarts@redhat.com>
Date: Tue, 14 Aug 2018 13:37:05 +0530
Subject: [PATCH 347/351] posix: fix unused variable warning
Change-Id: I42ece5c8903f5af7b5a4d6b7ab10516f987327c9
BUG: 1608363
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/146964
Tested-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/storage/posix/src/posix.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 5c6e103..49b272f 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -4680,7 +4680,6 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
char *value = NULL;
char *real_path = NULL;
dict_t *dict = NULL;
- char *file_contents = NULL;
int ret = -1;
char *path = NULL;
char *rpath = NULL;
--
1.8.3.1

View File

@ -0,0 +1,50 @@
From d542543faf4eca04737ddfe215e8988a700caf42 Mon Sep 17 00:00:00 2001
From: Amar Tumballi <amarts@redhat.com>
Date: Thu, 9 Aug 2018 10:17:56 +0530
Subject: [PATCH 348/351] posix: disable block and character files
The special files (block and character) needn't be supported on
n/w filesystem. As each of these files are used closely with the
host machine, instead of client data, we would be tied to server.
BUG: 1610966
Change-Id: Id65f1a6c51876a84c56cf691bb44a3e85ae73d70
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/146526
Reviewed-by: FNU Raghavendra Manjunath <raghavendra@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/storage/posix/src/posix.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 49b272f..28d2e6f 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -1452,6 +1452,23 @@ posix_mknod (call_frame_t *frame, xlator_t *this,
}
+ if (((mode & S_IFMT) == S_IFBLK) || ((mode & S_IFMT) == S_IFCHR)) {
+ /* Man page 'man 2 mknod':
+ EPERM mode requested creation of something other than
+ a regular file, FIFO (named pipe), or UNIX domain socket,
+ and the caller is not privileged (Linux: does not have the
+ CAP_MKNOD capability); also returned if the filesystem
+ containing pathname does not support the type of node
+ requested.
+ */
+ op_ret = -1;
+ op_errno = EPERM;
+ gf_msg (this->name, GF_LOG_ERROR, op_errno, P_MSG_MKNOD_FAILED,
+ "%s: mknod failed as Block and Character devices "
+ "are not supported on GlusterFS", real_path);
+ goto out;
+ }
+
op_ret = posix_pstat (this, loc->pargfid, par_path, &preparent);
if (op_ret == -1) {
op_errno = errno;
--
1.8.3.1

View File

@ -0,0 +1,65 @@
From 11ae607a1c958f166e689bacf00acbae989c4d8e Mon Sep 17 00:00:00 2001
From: Amar Tumballi <amarts@redhat.com>
Date: Thu, 9 Aug 2018 13:00:01 +0530
Subject: [PATCH 349/351] posix: don't allow '../' path in 'name'
This will prevent any arbitrary file creation through glusterfs
by modifying the client bits.
BUG: 1613686
BUG: 1613685
BUG: 1613684
Change-Id: I6def64956d9e5541e7f70a8910a4d6ce4bde61e9
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/146548
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Reviewed-by: Nithya Balachandran <nbalacha@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/protocol/server/src/server-resolve.c | 12 ++++++++++++
xlators/storage/posix/src/posix-handle.h | 5 +++++
2 files changed, 17 insertions(+)
diff --git a/xlators/protocol/server/src/server-resolve.c b/xlators/protocol/server/src/server-resolve.c
index 6ffb909..b3eda0e 100644
--- a/xlators/protocol/server/src/server-resolve.c
+++ b/xlators/protocol/server/src/server-resolve.c
@@ -311,6 +311,18 @@ resolve_entry_simple (call_frame_t *frame)
/* expected @parent was found from the inode cache */
gf_uuid_copy (state->loc_now->pargfid, resolve->pargfid);
state->loc_now->parent = inode_ref (parent);
+
+ if (strstr (resolve->bname, "../")) {
+ /* Resolving outside the parent's tree is not allowed */
+ gf_msg (this->name, GF_LOG_ERROR, EPERM,
+ PS_MSG_GFID_RESOLVE_FAILED,
+ "%s: path sent by client not allowed",
+ resolve->bname);
+ resolve->op_ret = -1;
+ resolve->op_errno = EPERM;
+ ret = 1;
+ goto out;
+ }
state->loc_now->name = resolve->bname;
inode = inode_grep (state->itable, parent, resolve->bname);
diff --git a/xlators/storage/posix/src/posix-handle.h b/xlators/storage/posix/src/posix-handle.h
index cb1f84e..a0f82ec 100644
--- a/xlators/storage/posix/src/posix-handle.h
+++ b/xlators/storage/posix/src/posix-handle.h
@@ -223,6 +223,11 @@
break; \
} \
\
+ if (strstr (loc->name, "../")) { \
+ gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_ENTRY_HANDLE_CREATE, \
+ "'../' in name not allowed: (%s)", loc->name); \
+ break; \
+ } \
if (LOC_HAS_ABSPATH (loc)) { \
MAKE_REAL_PATH (entp, this, loc->path); \
__parp = strdupa (entp); \
--
1.8.3.1

View File

@ -0,0 +1,99 @@
From 59fafc2b918846cc59daac107981211fa1568335 Mon Sep 17 00:00:00 2001
From: Susant Palai <spalai@redhat.com>
Date: Mon, 6 Aug 2018 15:02:58 +0530
Subject: [PATCH 350/351] cluster/dht: fix inode ref management in
dht_heal_path
In dht_heal_path, the inodes are created & looked up from top to down.
If the path is "a/b/c", then lookup will be done on a, then b and so
on. Here is a rough snippet of the function "dht_heal_path".
<snippet>
if (bname) { ref_count
- loc.inode = create/grep inode 1
- syncop_lookup (loc.inode)
- linked_inode = inode_link (loc.inode) 2
/*clean up current loc*/
- loc_wipe(&loc) 1
/*set up parent and bname for next child */
- loc.parent = inode
- bname = next_child_name
}
out:
- inode_ref (linked_inode) 2
- loc_wipe (&loc) 1
</snippet>
The problem with the above code is if _bname_ is empty ie the chain lookup is
done, then for the next iteration we populate loc.parent anyway. Now that
bname is empty, the loc_wipe is done in the _out_ section as well. Since, the
loc.parent was set to the previous inode, we lose a ref unwantedly. Now a
dht_local_wipe as part of the DHT_STACK_UNWIND takes away the last ref leading
to inode_destroy.
This problenm is observed currently with nfs-ganesha with the nameless lookup.
Post the inode_purge, gfapi does not get the new inode to link and hence, it links
the inode it sent in the lookup fop, which does not have any dht related context
(layout) leading to "invalid argument error" in lookup path done parallely with tar
operation.
test done in the following way:
- create two nfs client connected with two different nfs servers.
- run untar on one client and run lookup continuously on the other.
- Prior to this patch, invalid arguement was seen which is fixed with
the current patch.
> Change-Id: Ifb90c178a2f3c16604068c7da8fa562b877f5c61
> fixes: bz#1610256
> Signed-off-by: Susant Palai <spalai@redhat.com>
(backport of https://review.gluster.org/#/c/glusterfs/+/20643/)
Fixes: bz#1569657
Change-Id: I94329f2d148c31fe85a8753256e7aaf1d4d337ac
BUG: 1569657
Signed-off-by: Susant Palai <spalai@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/146966
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
xlators/cluster/dht/src/dht-helper.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c
index 09ca966..d35d7e8 100644
--- a/xlators/cluster/dht/src/dht-helper.c
+++ b/xlators/cluster/dht/src/dht-helper.c
@@ -1974,12 +1974,16 @@ dht_heal_path (xlator_t *this, char *path, inode_table_t *itable)
} else {
/*
* Inode is already populated in the inode table.
- * Which means we already looked up the inde and
+ * Which means we already looked up the inode and
* linked with a dentry. So that we will skip
* lookup on this entry, and proceed to next.
*/
+ linked_inode = loc.inode;
bname = strtok_r (NULL, "/", &save_ptr);
inode_unref (loc.parent);
+ if (!bname) {
+ goto out;
+ }
loc.parent = loc.inode;
gf_uuid_copy (loc.pargfid, loc.inode->gfid);
loc.inode = NULL;
@@ -2005,9 +2009,10 @@ dht_heal_path (xlator_t *this, char *path, inode_table_t *itable)
loc_wipe (&loc);
gf_uuid_copy (loc.pargfid, linked_inode->gfid);
loc.inode = NULL;
- loc.parent = linked_inode;
bname = strtok_r (NULL, "/", &save_ptr);
+ if (bname)
+ loc.parent = linked_inode;
}
out:
inode_ref (linked_inode);
--
1.8.3.1

View File

@ -0,0 +1,40 @@
From 72729dfb7c320880980eca6b2f0139658f259788 Mon Sep 17 00:00:00 2001
From: N Balachandran <nbalacha@redhat.com>
Date: Mon, 13 Aug 2018 22:17:17 +0530
Subject: [PATCH 351/351] cluster/dht: Fixed rebalanced files
An error caused skipped files to be counted as
rebalanced files.
Upstream patch: https://review.gluster.org/#/c/glusterfs/+/20724/
> Change-Id: I02333f099fb8b73ba953f41a2922021a1e4da7be
> fixes: bz#1615474
> Signed-off-by: N Balachandran <nbalacha@redhat.com>
Change-Id: I6921f92c4a784c51833ade8e1cde4744c0fd0d00
BUG: 1615338
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/147007
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: RHGS Build Bot <nigelb@redhat.com>
---
xlators/cluster/dht/src/dht-rebalance.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index b9078e0..d0f49d2 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -2841,7 +2841,7 @@ gf_defrag_migrate_single_file (void *opaque)
}
ret = 0;
-
+ goto out;
} else if (ret < 0) {
if (fop_errno != EEXIST) {
gf_msg (this->name, GF_LOG_ERROR, fop_errno,
--
1.8.3.1

View File

@ -192,7 +192,7 @@ Release: 0.1%{?prereltag:.%{prereltag}}%{?dist}
%else
Name: glusterfs
Version: 3.12.2
Release: 15%{?dist}
Release: 16%{?dist}
%endif
License: GPLv2 or LGPLv3+
Group: System Environment/Base
@ -598,6 +598,24 @@ Patch0330: 0330-posix-check-before-removing-stale-symlink.patch
Patch0331: 0331-rpc-free-registered-callback-programs.patch
Patch0332: 0332-rpc-rpc_clnt_connection_cleanup-is-crashed-due-to-do.patch
Patch0333: 0333-glusterd-Add-multiple-checks-before-attach-start-a-b.patch
Patch0334: 0334-glusterd-Bricks-of-a-normal-volumes-should-not-attac.patch
Patch0335: 0335-cluster-ec-set-others.eager-lock-option-off-by-defau.patch
Patch0336: 0336-dict-handle-negative-key-value-length-while-unserial.patch
Patch0337: 0337-glusterfs-Brick-process-is-crash-at-the-time-of-call.patch
Patch0338: 0338-posix-prevent-crash-when-SEEK_DATA-HOLE-is-not-suppo.patch
Patch0339: 0339-posix-remove-not-supported-get-set-content.patch
Patch0340: 0340-protocol-don-t-use-alloca.patch
Patch0341: 0341-Revert-glusterd-enable-brick-multiplexing-by-default.patch
Patch0342: 0342-glusterd-more-stricter-checks-of-if-brick-is-running.patch
Patch0343: 0343-core-Update-condition-in-get_xlator_by_name_or_type.patch
Patch0344: 0344-glusterd-Compare-volume_id-before-start-attach-a-bri.patch
Patch0345: 0345-io-stats-allow-only-relative-path-for-dumping-io-sta.patch
Patch0346: 0346-gfapi-Handle-the-path-glfs_resolve_at.patch
Patch0347: 0347-posix-fix-unused-variable-warning.patch
Patch0348: 0348-posix-disable-block-and-character-files.patch
Patch0349: 0349-posix-don-t-allow-.-path-in-name.patch
Patch0350: 0350-cluster-dht-fix-inode-ref-management-in-dht_heal_pat.patch
Patch0351: 0351-cluster-dht-Fixed-rebalanced-files.patch
%description
GlusterFS is a distributed file-system capable of scaling to several
@ -2546,6 +2564,10 @@ fi
%endif
%changelog
* Tue Aug 14 2018 Milind Changire <mchangir@redhat.com> - 3.12.2-16
- fixes bugs bz#1569657 bz#1608352 bz#1609163 bz#1609724 bz#1610825
bz#1611151 bz#1612098 bz#1615338 bz#1615440
* Fri Jul 27 2018 Milind Changire <mchangir@redhat.com> - 3.12.2-15
- fixes bugs bz#1589279 bz#1598384 bz#1599362 bz#1599998 bz#1600790
bz#1601331 bz#1603103