summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-op-sm.c
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kp@gluster.com>2011-05-03 05:04:57 +0000
committerAnand Avati <avati@gluster.com>2011-05-04 05:00:11 -0700
commite3571d4aab9b727715f0e51d12e6e0596f0111ce (patch)
tree2c9871da15306ad8c4fdb028cbf4ff37daa3976d /xlators/mgmt/glusterd/src/glusterd-op-sm.c
parentf5708f4d0696529faf1fb0ad108123a76c816d78 (diff)
glusterd: Checked brick path length in 'staging'.
Added checks for brick path length in 'staging' of add/replace brick and create_volume subcommands. Signed-off-by: Krishnan Parthasarathi <kp@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2847 (volume creation fails if brick path is long) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2847
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index b89e9b60253..5954a7b6f0f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -355,6 +355,18 @@ glusterd_op_stage_create_volume (dict_t *dict, char **op_errstr)
i++;
brick= strtok_r (brick_list, " \n", &tmpptr);
brick_list = tmpptr;
+
+ if (!glusterd_store_is_valid_brickpath (volname, brick) ||
+ !glusterd_is_valid_volfpath (volname, brick)) {
+ snprintf (msg, sizeof (msg), "brick path %s is too "
+ "long.", brick);
+ gf_log ("", GF_LOG_ERROR, "%s", msg);
+ *op_errstr = gf_strdup (msg);
+
+ ret = -1;
+ goto out;
+ }
+
ret = glusterd_brickinfo_from_brick (brick, &brick_info);
if (ret)
goto out;
@@ -691,6 +703,18 @@ glusterd_op_stage_add_brick (dict_t *dict, char **op_errstr)
while ( i < count) {
+ if (!glusterd_store_is_valid_brickpath (volname, brick) ||
+ !glusterd_is_valid_volfpath (volname, brick)) {
+ snprintf (msg, sizeof (msg), "brick path %s is too "
+ "long.", brick);
+ gf_log ("", GF_LOG_ERROR, "%s", msg);
+ *op_errstr = gf_strdup (msg);
+
+ ret = -1;
+ goto out;
+
+ }
+
ret = glusterd_volume_brickinfo_get_by_brick (brick, volinfo,
&brickinfo);
if (!ret) {
@@ -888,6 +912,17 @@ glusterd_op_stage_replace_brick (dict_t *dict, char **op_errstr,
goto out;
}
+ if (!glusterd_store_is_valid_brickpath (volname, dst_brick) ||
+ !glusterd_is_valid_volfpath (volname, dst_brick)) {
+ snprintf (msg, sizeof (msg), "brick path %s is too "
+ "long.", dst_brick);
+ gf_log ("", GF_LOG_ERROR, "%s", msg);
+ *op_errstr = gf_strdup (msg);
+
+ ret = -1;
+ goto out;
+ }
+
ret = glusterd_check_gsync_running (volinfo, &is_run);
if (ret && (is_run == _gf_false))
gf_log ("", GF_LOG_WARNING, "Unable to get the status"