1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

vgchange: check for mounted fs

Check for mounted fs also for vgchange command, not just lvchange.

NOTE: Code is using lv_info() just like lvs_in_vg_opened().
It should be probably converted into  lv_is_active_locally().
This commit is contained in:
Zdenek Kabelac 2012-03-08 23:43:28 +01:00
parent 810bc4f8c1
commit 2ada982e73
2 changed files with 11 additions and 3 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
Add detection of mounted fs also for vgchange deactivation.
Replace 'lv_is_active' with more correct/specific variants (e.g. *_locally).
Refuse to init a snapshot merge in lvconvert if there's no kernel support.
Fix exported symbols regex for non-GNU busybox sed.

View File

@ -191,6 +191,8 @@ int vgchange_activate(struct cmd_context *cmd, struct volume_group *vg,
activation_change_t activate)
{
int lv_open, active, monitored = 0, r = 1, do_activate = 1;
const struct lv_list *lvl;
struct lvinfo info;
if ((activate == CHANGE_AN) || (activate == CHANGE_ALN))
do_activate = 0;
@ -203,10 +205,15 @@ int vgchange_activate(struct cmd_context *cmd, struct volume_group *vg,
/* FIXME: Force argument to deactivate them? */
if (!do_activate && (lv_open = lvs_in_vg_opened(vg))) {
dm_list_iterate_items(lvl, &vg->lvs)
if (lv_is_visible(lvl->lv) &&
lv_info(cmd, lvl->lv, 0, &info, 1, 0) &&
!lv_check_not_in_use(cmd, lvl->lv, &info)) {
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 */
if (do_activate)