Validate stripe-block-size option

Minimum size is 512 bytes and should be a multiple of 512 bytes.

Signed-off-by: shishir gowda <shishirng@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>

BUG: 2861 (Stripe block-size has no check for valid option)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2861
This commit is contained in:
shishir gowda 2011-05-02 05:08:39 +00:00 committed by Anand Avati
parent 0f020affb2
commit 276c0cecad

View File

@ -3750,6 +3750,18 @@ set_stripe_block_size (xlator_t *this, stripe_private_t *priv, char *data)
"invalid number format \"%s\"", num);
goto out;
}
if (stripe_opt->block_size < 512) {
gf_log (this->name, GF_LOG_ERROR, "Invalid Block-size: "
"%s. Should be atleast 512 bytes", num);
goto out;
}
if (stripe_opt->block_size % 512) {
gf_log (this->name, GF_LOG_ERROR, "Block-size: %s should"
" be a multiple of 512 bytes", num);
goto out;
}
memcpy (stripe_opt->path_pattern, pattern, strlen (pattern));
gf_log (this->name, GF_LOG_DEBUG,