From 276c0cecadbe763e98c5cfd18b3ad32822964789 Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Mon, 2 May 2011 05:08:39 +0000 Subject: Validate stripe-block-size option Minimum size is 512 bytes and should be a multiple of 512 bytes. Signed-off-by: shishir gowda Signed-off-by: Anand Avati BUG: 2861 (Stripe block-size has no check for valid option) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2861 --- xlators/cluster/stripe/src/stripe.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'xlators') diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index a06d275df..8f6790777 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -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, -- cgit