diff options
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-snapshot.c | 17 |
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 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; } |