1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

metadata: When outdated PVs are wiped, notify lvmetad about the fact.

This commit is contained in:
Petr Rockai 2015-06-10 16:27:12 +02:00
parent c78b6f18d4
commit 632dde0cbc
3 changed files with 22 additions and 1 deletions

16
lib/cache/lvmetad.c vendored
View File

@ -1161,3 +1161,19 @@ int lvmetad_pvscan_foreign_vgs(struct cmd_context *cmd, activation_handler handl
{
return _lvmetad_pvscan_all_devs(cmd, handler, 1);
}
int lvmetad_vg_clear_outdated_pvs(struct volume_group *vg)
{
char uuid[64];
daemon_reply reply;
int result;
if (!id_write_format(&vg->id, uuid, sizeof(uuid)))
return_0;
reply = _lvmetad_send("vg_clear_outdated_pvs", "vgid = %s", uuid, NULL);
result = _lvmetad_handle_reply(reply, "clear the list of outdated PVs", vg->name, NULL);
daemon_reply_destroy(reply);
return result;
}

3
lib/cache/lvmetad.h vendored
View File

@ -166,6 +166,8 @@ int lvmetad_pvscan_single(struct cmd_context *cmd, struct device *dev,
int lvmetad_pvscan_all_devs(struct cmd_context *cmd, activation_handler handler);
int lvmetad_pvscan_foreign_vgs(struct cmd_context *cmd, activation_handler handler);
int lvmetad_vg_clear_outdated_pvs(struct volume_group *vg);
# else /* LVMETAD_SUPPORT */
# define lvmetad_init(cmd) do { } while (0)
@ -192,6 +194,7 @@ int lvmetad_pvscan_foreign_vgs(struct cmd_context *cmd, activation_handler handl
# define lvmetad_pvscan_single(cmd, dev, handler, ignore_obsolete) (0)
# define lvmetad_pvscan_all_devs(cmd, handler) (0)
# define lvmetad_pvscan_foreign_vgs(cmd, handler) (0)
# define lvmetad_vg_clear_outdated_pvs(vg) (1)
# endif /* LVMETAD_SUPPORT */

View File

@ -3307,9 +3307,11 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
*consistent = _repair_inconsistent_vg(correct_vg);
else
*consistent = !reappeared;
if (_wipe_outdated_pvs(cmd, correct_vg, &correct_vg->pvs_outdated))
if (_wipe_outdated_pvs(cmd, correct_vg, &correct_vg->pvs_outdated)) {
/* clear the list */
dm_list_init(&correct_vg->pvs_outdated);
lvmetad_vg_clear_outdated_pvs(correct_vg);
}
}
return correct_vg;
}