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

lvcreate: use lv_passes_readonly_filter

Check if created LV is going to be activated read-only
because such LV cannot be zeroed (equals to use
option '-pr').
This commit is contained in:
Zdenek Kabelac 2021-02-02 19:53:59 +01:00
parent 8454ce66c5
commit 51c83f1483
4 changed files with 14 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.03.12 -
===================================
Check if lvcreate passes read_only_volume_list with tags and skips zeroing.
Allocation prints better error when metadata cannot fit on a single PV.
Pvmove can better resolve full thin-pool tree move.
Limit pool metadata spare to 16GiB.

View File

@ -466,6 +466,11 @@ static int _passes_readonly_filter(struct cmd_context *cmd,
return _lv_passes_volumes_filter(cmd, lv, cn, activation_read_only_volume_list_CFG);
}
int lv_passes_readonly_filter(const struct logical_volume *lv)
{
return _passes_readonly_filter(lv->vg->cmd, lv);
}
int library_version(char *version, size_t size)
{
if (!activation())

View File

@ -208,6 +208,8 @@ int lvs_in_vg_opened(const struct volume_group *vg);
int lv_is_active(const struct logical_volume *lv);
int lv_passes_readonly_filter(const struct logical_volume *lv);
/* Check is any component LV is active */
const struct logical_volume *lv_component_is_active(const struct logical_volume *lv);
const struct logical_volume *lv_holder_is_active(const struct logical_volume *lv);

View File

@ -7987,6 +7987,12 @@ static int _should_wipe_lv(struct lvcreate_params *lp,
first_seg(first_seg(lv)->pool_lv)->zero_new_blocks))
return 0;
if (warn && (lv_passes_readonly_filter(lv))) {
log_warn("WARNING: Read-only activated logical volume %s not zeroed.",
display_lvname(lv));
return 0;
}
/* Cannot zero read-only volume */
if ((lv->status & LVM_WRITE) &&
(lp->zero || lp->wipe_signatures))