summaryrefslogtreecommitdiff
path: root/tools/vgchange.c
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2018-02-16 14:18:55 -0600
committerDavid Teigland <teigland@redhat.com>2018-04-20 11:22:47 -0500
commit0da296003d3af3f505213a25783dda534af2d9d6 (patch)
treef9f43ae2c47d557f4433103fd0dc41c1923787d6 /tools/vgchange.c
parent34fd818caf89f39dab58ef2ce7c60c193db02cf0 (diff)
downloadlvm2-0da296003d3af3f505213a25783dda534af2d9d6.tar.gz
vgchange: invalidate bcache for stacked LVs when deactivating
An LV with a stacked PV will be open in bcache and needs to be invalidated to close the fd before attempting to deactivate.
Diffstat (limited to 'tools/vgchange.c')
-rw-r--r--tools/vgchange.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 7cfaab6a1..61b78dfd0 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -209,14 +209,19 @@ int vgchange_activate(struct cmd_context *cmd, struct volume_group *vg,
cmd->handles_missing_pvs = 1;
/* FIXME: Force argument to deactivate them? */
- if (!do_activate && (lv_open = lvs_in_vg_opened(vg))) {
+ if (!do_activate) {
dm_list_iterate_items(lvl, &vg->lvs)
- if (lv_is_visible(lvl->lv) &&
- !lv_check_not_in_use(lvl->lv, 1)) {
- log_error("Can't deactivate volume group \"%s\" with %d open "
- "logical volume(s)", vg->name, lv_open);
- return 0;
+ label_scan_invalidate_lv(cmd, lvl->lv);
+
+ if ((lv_open = lvs_in_vg_opened(vg))) {
+ dm_list_iterate_items(lvl, &vg->lvs) {
+ if (lv_is_visible(lvl->lv) && !lv_check_not_in_use(lvl->lv, 1)) {
+ log_error("Can't deactivate volume group \"%s\" with %d open logical volume(s)",
+ vg->name, lv_open);
+ return 0;
+ }
}
+ }
}
/* FIXME Move into library where clvmd can use it */