1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-12 08:13:48 +03:00

toollib: avoid repeated remove of online vg

Call just once unlink after every deactivation of LV from VG.
This commit is contained in:
Zdenek Kabelac 2021-12-17 13:18:56 +01:00
parent 522561e64b
commit ed1651d11f
2 changed files with 7 additions and 1 deletions

View File

@ -202,6 +202,7 @@ struct cmd_context {
unsigned backup_disabled:1; /* skip repeated debug message */
unsigned event_activation:1; /* whether event_activation is set */
unsigned udevoutput:1;
unsigned online_vg_file_removed:1;
/*
* Devices and filtering.

View File

@ -829,8 +829,11 @@ int lv_change_activate(struct cmd_context *cmd, struct logical_volume *lv,
* user may want to take charge of activation changes to the VG
* and not have the system autoactivation interfere.
*/
if (!is_change_activating(activate) && cmd->event_activation)
if (!is_change_activating(activate) && cmd->event_activation &&
!cmd->online_vg_file_removed) {
cmd->online_vg_file_removed = 1;
online_vg_file_remove(lv->vg->name);
}
set_lv_notify(lv->vg->cmd);
@ -2983,6 +2986,8 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
struct glv_list *glvl, *tglvl;
int do_report_ret_code = 1;
cmd->online_vg_file_removed = 0;
log_set_report_object_type(LOG_REPORT_OBJECT_TYPE_LV);
vg_uuid[0] = '\0';