mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
lvconvert: use LV_TEMPORARY when necessary during lvconvert to thin pool
This is an addition to original patch for lvcreate - commit 039bdad
.
The same principle applies to lvconvert where there are several steps
during which we need to wipe the existing LV that's being converted
to thin pool, making sure there's no other interference from outside (udev).
This commit is contained in:
parent
9d0621267d
commit
f1a42aa8ec
@ -2435,14 +2435,8 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
|
||||
goto mda_write;
|
||||
}
|
||||
|
||||
metadata_lv->status |= LV_NOSCAN;
|
||||
if (!lv_is_active(metadata_lv) &&
|
||||
!activate_lv_local(cmd, metadata_lv)) {
|
||||
log_error("Aborting. Failed to activate thin metadata lv.");
|
||||
return 0;
|
||||
}
|
||||
if (!set_lv(cmd, metadata_lv, UINT64_C(0), 0)) {
|
||||
log_error("Aborting. Failed to wipe thin metadata lv.");
|
||||
if (!deactivate_lv(cmd, metadata_lv)) {
|
||||
log_error("Aborting. Failed to deactivate thin metadata lv.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2462,6 +2456,16 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
|
||||
&lp->thin_chunk_size_calc_policy, &lp->chunk_size,
|
||||
&lp->discards, &lp->poolmetadata_size, &lp->zero))
|
||||
return_0;
|
||||
|
||||
metadata_lv->status |= LV_TEMPORARY;
|
||||
if (!activate_lv_local(cmd, metadata_lv)) {
|
||||
log_error("Aborting. Failed to activate thin metadata lv.");
|
||||
return 0;
|
||||
}
|
||||
if (!set_lv(cmd, metadata_lv, UINT64_C(0), 0)) {
|
||||
log_error("Aborting. Failed to wipe thin metadata lv.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!deactivate_lv(cmd, metadata_lv)) {
|
||||
|
Loading…
Reference in New Issue
Block a user