mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cache: allow deactivation of empty pool
Tool will use internal activation of unused cache pool to clear metadata area before next use of cache-pool. So allow to deactivation unused pool in case some error case happend and we were not able to deactivation pool right after metadata wipe.
This commit is contained in:
parent
969ab6bbf0
commit
0b7335f847
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
|
||||
* Copyright (C) 2004-2014 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
@ -170,9 +170,6 @@ static int _lvchange_activate(struct cmd_context *cmd, struct logical_volume *lv
|
||||
|
||||
activate = (activation_change_t) arg_uint_value(cmd, activate_ARG, CHANGE_AY);
|
||||
|
||||
if (lv_is_cache_pool(lv))
|
||||
return 1;
|
||||
|
||||
if (lv_activation_skip(lv, activate, arg_count(cmd, ignoreactivationskip_ARG)))
|
||||
return 1;
|
||||
|
||||
|
@ -688,6 +688,23 @@ int lv_change_activate(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
{
|
||||
int r = 1;
|
||||
|
||||
if (lv_is_cache_pool(lv)) {
|
||||
if (is_change_activating(activate)) {
|
||||
log_verbose("Skipping activation of cache pool %s.",
|
||||
display_lvname(lv));
|
||||
return 1;
|
||||
}
|
||||
if (!dm_list_empty(&lv->segs_using_this_lv)) {
|
||||
log_verbose("Skipping deactivation of used cache pool %s.",
|
||||
display_lvname(lv));
|
||||
return 1;
|
||||
}
|
||||
/*
|
||||
* Allow to pass only deactivation of unused cache pool.
|
||||
* Useful only for recovery of failed zeroing of metadata LV.
|
||||
*/
|
||||
}
|
||||
|
||||
if (lv_is_merging_origin(lv)) {
|
||||
/*
|
||||
* For merging origin, its snapshot must be inactive.
|
||||
|
@ -97,10 +97,6 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd, struct volume_group *vg,
|
||||
if (!lv_is_visible(lv))
|
||||
continue;
|
||||
|
||||
/* Cache pool cannot be activated */
|
||||
if (lv_is_cache_pool(lv))
|
||||
continue;
|
||||
|
||||
/* If LV is sparse, activate origin instead */
|
||||
if (lv_is_cow(lv) && lv_is_virtual_origin(origin_from_cow(lv)))
|
||||
lv = origin_from_cow(lv);
|
||||
|
Loading…
Reference in New Issue
Block a user