summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
diff options
context:
space:
mode:
authorkrad <krad@fb.com>2017-07-18 16:41:49 -0700
committerJeff Darcy <jeff@pl.atyp.us>2017-09-13 17:50:36 +0000
commit8a3de0b4ca841cc2405b7e60ecf70f8eca62b800 (patch)
tree9319a76e0a97f53720eab4ed35ac43cb43cd09d4 /xlators/mgmt/glusterd/src/glusterd-volume-ops.c
parent3b0757b51a34bc726a40935e644f0e0498e7beff (diff)
Disable brick daemon from incorrect brick directory
Summary: Currently the bricks can open any mount directory from the given volume. This patch adds a provision to prevent bricks from opening brick directories that aren't created for them. This will help with operating gluster on large scale. We add a new xattr GF_XATTR_BRICK_NAME to the brick directory. When we start a brick daemon, we make sure the path on disk matches with the config provided. For backward compatibility, we ignore if there is no value for GF_XATTR_BRICK_NAME and set the current brick daemon's path as value. We ignore GF_XATTR_BRICK_NAME during healing and reset GF_XATTR_BRICK_NAME on brick replace. Test Plan: Run fb-smoke Reviewers: jdarcy, sshreyas Reviewed By: sshreyas Differential Revision: https://phabricator.intern.facebook.com/D5448921 Porting note: disabled some checks to deal with the snapshot case Change-Id: I98e62033dfd07f30ad3b99ac003ce94c8d935e5f Signed-off-by: Jeff Darcy <jdarcy@fb.com> Reviewed-on: https://review.gluster.org/18275 Reviewed-by: Jeff Darcy <jeff@pl.atyp.us> Tested-by: Jeff Darcy <jeff@pl.atyp.us> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volume-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-ops.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
index 97fb5605715..9fb60cc0802 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
@@ -1610,6 +1610,24 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr,
goto out;
}
+ /* check GF_XATTR_BRICK_PATH is set to brick path */
+ ret = gf_compare_or_fix_xattr_brick_path (brickinfo->path);
+
+ if (ret != 0) {
+ gf_log (this->name, GF_LOG_ERROR, "Error comparing %s "
+ "on %s", GF_XATTR_BRICK_PATH, brickinfo->path);
+ if (strstr (brickinfo->path, "/snaps/")) {
+ /*
+ * This is "naturally" going to be wrong on
+ * snap bricks, but that's OK.
+ */
+ ret = 0;
+ } else {
+ ret = -1;
+ goto out;
+ }
+ }
+
/* A bricks mount dir is required only by snapshots which were
* introduced in gluster-3.6.0
*/