diff --git a/meta2v2/meta2_backend.c b/meta2v2/meta2_backend.c index 4ffaf0631a..83ed9a4664 100644 --- a/meta2v2/meta2_backend.c +++ b/meta2v2/meta2_backend.c @@ -1481,9 +1481,12 @@ meta2_backend_generate_beans(struct meta2_backend_s *m2b, * This call may return an open database. */ m2b_get_prepare_data(m2b, url, &pdata, &sq3); - if ((m2b->flag_precheck_on_generate && - VERSIONS_DISABLED(pdata.max_versions)) || - (oio_ns_mode_worm && !oio_ext_is_admin())) { + gboolean must_check_alias = m2b->flag_precheck_on_generate && ( + VERSIONS_DISABLED(pdata.max_versions) || + (VERSIONS_SUSPENDED(pdata.max_versions) && + oio_ns_mode_worm && + !oio_ext_is_admin())); + if (must_check_alias) { err = m2b_open_if_needed(m2b, url, _mode_masterslave(0)|M2V2_OPEN_ENABLED, &sq3); if (!err) { diff --git a/meta2v2/meta2_utils.c b/meta2v2/meta2_utils.c index 3bf1fae8e2..ad4dc6ab01 100644 --- a/meta2v2/meta2_utils.c +++ b/meta2v2/meta2_utils.c @@ -1522,10 +1522,6 @@ GError* m2db_put_alias(struct m2db_put_args_s *args, GSList *beans, /* Check the operation respects the rules of versioning for the container */ if (latest) { - if (args->worm_mode) { - err = NEWERROR(CODE_CONTENT_EXISTS, "NS wormed! Cannot overwrite."); - } - if (VERSIONS_DISABLED(max_versions)) { if (ALIASES_get_deleted(latest) || ALIASES_get_version(latest) > 0) { GRID_DEBUG("Versioning DISABLED but clues of SUSPENDED"); @@ -1536,6 +1532,11 @@ GError* m2db_put_alias(struct m2db_put_args_s *args, GSList *beans, } else if (VERSIONS_SUSPENDED(max_versions)) { suspended: + if (args->worm_mode) { + err = NEWERROR(CODE_CONTENT_EXISTS, + "NS wormed! Cannot overwrite."); + } + // JFS: do not alter the size to manage the alias being removed, // this will be done by the real purge of the latest. purge_latest = TRUE;