summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSachin Pandit <spandit@redhat.com>2014-04-04 03:23:21 +0530
committerRajesh Joseph <rjoseph@redhat.com>2014-04-04 04:26:01 -0700
commit960ce829906292836f2a34f35f4182011cfe5fb2 (patch)
treea13db87c55f097330005fccddb5150908918a1a5
parent89414cb24ed47984445aecd88fa3ca73597ebed9 (diff)
glusterd/snapshot : Fix for snap creation beyond effective snap-max-hard-limit.
Change-Id: I679a1b01bb9d8a41fe463acf4406d896caf939c8 BUG: 1083879 Signed-off-by: Sachin Pandit <spandit@redhat.com> Reviewed-on: http://review.gluster.org/7396 Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Tested-by: Rajesh Joseph <rjoseph@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index e8587b5..a6c79e4 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -594,9 +594,13 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
xlator_t *this = NULL;
uuid_t *snap_volid = NULL;
gf_loglevel_t loglevel = GF_LOG_ERROR;
+ glusterd_conf_t *conf = NULL;
+ int64_t effective_max_limit = 0;
this = THIS;
GF_ASSERT (op_errstr);
+ conf = this->private;
+ GF_ASSERT (conf);
ret = dict_get_int64 (dict, "volcount", &volcount);
if (ret) {
@@ -661,11 +665,18 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
loglevel = GF_LOG_WARNING;
goto out;
}
- if (volinfo->snap_count >= volinfo->snap_max_hard_limit) {
+
+ if (volinfo->snap_max_hard_limit < conf->snap_max_hard_limit)
+ effective_max_limit = volinfo->snap_max_hard_limit;
+ else
+ effective_max_limit = conf->snap_max_hard_limit;
+
+ if (volinfo->snap_count >= effective_max_limit) {
snprintf (err_str, sizeof (err_str),
"The number of existing snaps has reached the "
- "maximum limit of %"PRIu64" ,for the volume %s",
- volinfo->snap_max_hard_limit, volname);
+ "effective maximum limit of %"PRIu64" ,"
+ "for the volume %s", effective_max_limit,
+ volname);
loglevel = GF_LOG_WARNING;
goto out;
}