mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
Thin clear stacked message for thin pool
Before removing thin pool LV always make sure, stacked message for previous run are cleared - but allow to remove any device that should have been created (i.e. creation of snapshot failed - so the message for snapshot creation may be replaced with delete message within unfinished transaction). Also commit messages after lv remove - so free space is released in pool.
This commit is contained in:
parent
c3f0ed04a6
commit
9b1fe5a062
@ -527,10 +527,6 @@ static int _lv_reduce(struct logical_volume *lv, uint32_t extents, int delete)
|
|||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
if (seg->pool_lv) {
|
if (seg->pool_lv) {
|
||||||
/* For now, clear stacked messages here */
|
|
||||||
if (!update_pool_lv(seg->pool_lv, 1))
|
|
||||||
return_0;
|
|
||||||
|
|
||||||
if (!detach_pool_lv(seg))
|
if (!detach_pool_lv(seg))
|
||||||
return_0;
|
return_0;
|
||||||
}
|
}
|
||||||
@ -3142,6 +3138,7 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
struct logical_volume *format1_origin = NULL;
|
struct logical_volume *format1_origin = NULL;
|
||||||
int format1_reload_required = 0;
|
int format1_reload_required = 0;
|
||||||
int visible;
|
int visible;
|
||||||
|
struct logical_volume *pool_lv = NULL;
|
||||||
|
|
||||||
vg = lv->vg;
|
vg = lv->vg;
|
||||||
|
|
||||||
@ -3176,7 +3173,8 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
log_error("Can't remove logical volume %s used by a thin pool.",
|
log_error("Can't remove logical volume %s used by a thin pool.",
|
||||||
lv->name);
|
lv->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else if (lv_is_thin_volume(lv))
|
||||||
|
pool_lv = first_seg(lv)->pool_lv;
|
||||||
|
|
||||||
if (lv->status & LOCKED) {
|
if (lv->status & LOCKED) {
|
||||||
log_error("Can't remove locked LV %s", lv->name);
|
log_error("Can't remove locked LV %s", lv->name);
|
||||||
@ -3222,6 +3220,13 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Clear thin pool stacked messages */
|
||||||
|
if (pool_lv && !pool_has_message(first_seg(pool_lv), lv, 0) &&
|
||||||
|
!update_pool_lv(pool_lv, 1)) {
|
||||||
|
log_error("Failed to update thin pool %s.", pool_lv->name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
visible = lv_is_visible(lv);
|
visible = lv_is_visible(lv);
|
||||||
|
|
||||||
log_verbose("Releasing logical volume \"%s\"", lv->name);
|
log_verbose("Releasing logical volume \"%s\"", lv->name);
|
||||||
@ -3256,6 +3261,13 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Release unneeded blocks in thin pool */
|
||||||
|
/* TODO: defer when multiple LVs relased at once */
|
||||||
|
if (pool_lv && !update_pool_lv(pool_lv, 1)) {
|
||||||
|
log_error("Failed to update thin pool %s.", pool_lv->name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
backup(vg);
|
backup(vg);
|
||||||
|
|
||||||
if (visible)
|
if (visible)
|
||||||
|
Loading…
Reference in New Issue
Block a user