diff --git a/lib/config/config.c b/lib/config/config.c index 820a744db..6ad04e549 100644 --- a/lib/config/config.c +++ b/lib/config/config.c @@ -496,7 +496,7 @@ int override_config_tree_from_profile(struct cmd_context *cmd, int config_file_read_fd(struct dm_config_tree *cft, struct device *dev, off_t offset, size_t size, off_t offset2, size_t size2, checksum_fn_t checksum_fn, uint32_t checksum, - int checksum_only) + int checksum_only, int no_dup_node_check) { char *fb, *fe; int r = 0; @@ -547,8 +547,13 @@ int config_file_read_fd(struct dm_config_tree *cft, struct device *dev, if (!checksum_only) { fe = fb + size + size2; - if (!dm_config_parse(cft, fb, fe)) - goto_out; + if (no_dup_node_check) { + if (!dm_config_parse_without_dup_node_check(cft, fb, fe)) + goto_out; + } else { + if (!dm_config_parse(cft, fb, fe)) + goto_out; + } } r = 1; @@ -596,7 +601,7 @@ int config_file_read(struct dm_config_tree *cft) } r = config_file_read_fd(cft, cf->dev, 0, (size_t) info.st_size, 0, 0, - (checksum_fn_t) NULL, 0, 0); + (checksum_fn_t) NULL, 0, 0, 0); if (!cf->keep_open) { if (!dev_close(cf->dev)) diff --git a/lib/config/config.h b/lib/config/config.h index f0202b619..8a7d6c327 100644 --- a/lib/config/config.h +++ b/lib/config/config.h @@ -239,7 +239,7 @@ struct dm_config_tree *config_open(config_source_t source, const char *filename, int config_file_read_fd(struct dm_config_tree *cft, struct device *dev, off_t offset, size_t size, off_t offset2, size_t size2, checksum_fn_t checksum_fn, uint32_t checksum, - int skip_parse); + int skip_parse, int no_dup_node_check); int config_file_read(struct dm_config_tree *cft); struct dm_config_tree *config_file_open_and_read(const char *config_file, config_source_t source, struct cmd_context *cmd); diff --git a/lib/format_text/import.c b/lib/format_text/import.c index 629884bbb..62dee8faf 100644 --- a/lib/format_text/import.c +++ b/lib/format_text/import.c @@ -56,7 +56,7 @@ int text_vgsummary_import(const struct format_type *fmt, (dev && !config_file_read_fd(cft, dev, offset, size, offset2, size2, checksum_fn, vgsummary->mda_checksum, - checksum_only))) { + checksum_only, 1))) { log_error("Couldn't read volume group metadata."); goto out; } @@ -130,7 +130,7 @@ struct volume_group *text_vg_import_fd(struct format_instance *fid, if ((!dev && !config_file_read(cft)) || (dev && !config_file_read_fd(cft, dev, offset, size, offset2, size2, checksum_fn, checksum, - skip_parse))) + skip_parse, 1))) goto_out; if (skip_parse) { diff --git a/tools/toollib.c b/tools/toollib.c index ec6f2f7c6..9127d85cd 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -1386,7 +1386,7 @@ int get_cache_params(struct cmd_context *cmd, NULL))) goto_out; - if (!dm_config_parse(current, str, str + strlen(str))) + if (!dm_config_parse_without_dup_node_check(current, str, str + strlen(str))) goto_out; }