summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorVarun Shastry <vshastry@redhat.com>2012-10-29 16:21:24 +0530
committerVijay Bellur <vbellur@redhat.com>2012-11-09 02:44:04 -0800
commit0d9a38bb576beac24d0694633a79cff7e8c11a9f (patch)
treef1944483e6d9eea5fcbb1a72d8c79af4f49e0fc8 /xlators
parentb0cb7aaf04eff033a329e017a8628c84a62e33cd (diff)
features/quota: Failure of quota commands if the dir-name contains ':' in it
PROBLEM: The first colon in the limit string is used to separate the path and the limit-value. The ':' in the path was the source of problem. FIX: Search for the last colon and separate based on the same. Added regression test. TEST: Create and set quota on directories with names containing ':' in start, middle and end. Change-Id: I363c8ad4cbfd02c23fc73974bef9aa8bc362d29c BUG: 848251 Signed-off-by: Varun Shastry <vshastry@redhat.com> Reviewed-on: http://review.gluster.org/4137 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/quota/src/quota.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index b60e37d9c..928fd3837 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -3025,14 +3025,17 @@ quota_parse_limits (quota_priv_t *priv, xlator_t *this, dict_t *xl_options,
char *path = NULL, *saveptr = NULL;
uint64_t value = 0;
limits_t *quota_lim = NULL, *old = NULL;
+ char *last_colon= NULL;
ret = dict_get_str (xl_options, "limit-set", &str);
if (str) {
- path = strtok_r (str, ":", &saveptr);
+ path = strtok_r (str, ",", &saveptr);
while (path) {
- str_val = strtok_r (NULL, ",", &saveptr);
+ last_colon = strrchr (path, ':');
+ *last_colon = '\0';
+ str_val = last_colon + 1;
ret = gf_string2bytesize (str_val, &value);
if (ret != 0)
@@ -3066,7 +3069,7 @@ quota_parse_limits (quota_priv_t *priv, xlator_t *this, dict_t *xl_options,
}
UNLOCK (&priv->lock);
- path = strtok_r (NULL, ":", &saveptr);
+ path = strtok_r (NULL, ",", &saveptr);
}
} else {
gf_log (this->name, GF_LOG_INFO,