diff --git a/WHATS_NEW b/WHATS_NEW index 45ce5748a..bc0c7787c 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.98 - ================================= + Add internal lv_rename_update() to rename LV without updating mda. Ensure descriptors 0,1,2 are always available. Use /proc/self/fd for closing openned descriptors. Add missing pkg init with --enable-testing in configure.in (2.02.71). diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index f2d99b8ff..eb5794cdf 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -2938,8 +2938,8 @@ int for_each_sub_lv(struct cmd_context *cmd, struct logical_volume *lv, * Core of LV renaming routine. * VG must be locked by caller. */ -int lv_rename(struct cmd_context *cmd, struct logical_volume *lv, - const char *new_name) +int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv, + const char *new_name, int update_mda) { struct volume_group *vg = lv->vg; struct lv_names lv_names; @@ -2964,7 +2964,7 @@ int lv_rename(struct cmd_context *cmd, struct logical_volume *lv, return 0; } - if (!archive(vg)) + if (update_mda && !archive(vg)) return 0; /* rename sub LVs */ @@ -2986,6 +2986,9 @@ int lv_rename(struct cmd_context *cmd, struct logical_volume *lv, if (lv_is_cow(lv) && lv_is_virtual_origin(lvl2.lv = origin_from_cow(lv))) dm_list_add_h(&lvs_changed, &lvl2.list); + if (!update_mda) + return 1; + log_verbose("Writing out updated volume group"); if (!vg_write(vg)) return 0; @@ -3009,6 +3012,16 @@ out: return r; } +/* + * Core of LV renaming routine. + * VG must be locked by caller. + */ +int lv_rename(struct cmd_context *cmd, struct logical_volume *lv, + const char *new_name) +{ + return lv_rename_update(cmd, lv, new_name, 1); +} + char *generate_lv_name(struct volume_group *vg, const char *format, char *buffer, size_t len) { diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h index 0658fade3..d149f953f 100644 --- a/lib/metadata/metadata-exported.h +++ b/lib/metadata/metadata-exported.h @@ -560,6 +560,8 @@ int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume * int lv_rename(struct cmd_context *cmd, struct logical_volume *lv, const char *new_name); +int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv, + const char *new_name, int update_mda); uint64_t extents_from_size(struct cmd_context *cmd, uint64_t size, uint32_t extent_size);