From 960ce829906292836f2a34f35f4182011cfe5fb2 Mon Sep 17 00:00:00 2001 From: Sachin Pandit Date: Fri, 4 Apr 2014 03:23:21 +0530 Subject: glusterd/snapshot : Fix for snap creation beyond effective snap-max-hard-limit. Change-Id: I679a1b01bb9d8a41fe463acf4406d896caf939c8 BUG: 1083879 Signed-off-by: Sachin Pandit Reviewed-on: http://review.gluster.org/7396 Reviewed-by: Raghavendra Bhat Reviewed-by: Rajesh Joseph Tested-by: Rajesh Joseph --- xlators/mgmt/glusterd/src/glusterd-snapshot.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c index e8587b55b..a6c79e4ec 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; } -- cgit