mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
wipe_lv: make error a fatal event
Failure in wiping/zeroing stop the command. If user wants to avoid command abortion he should use -Zn or -Wn to avoid wiping. Note: there is no easy way to distinguish which kind of failure has happend - so it's safe to not proceed any futher.
This commit is contained in:
parent
6eb9eba59b
commit
edbc5a62b2
@ -1,5 +1,6 @@
|
|||||||
Version 2.03.10 -
|
Version 2.03.10 -
|
||||||
=================================
|
=================================
|
||||||
|
Failure in zeroing or wiping will fail command (bypass with -Zn, -Wn).
|
||||||
Fix running out of free buffers for async writing for larger writes.
|
Fix running out of free buffers for async writing for larger writes.
|
||||||
Add integrity with raid capability.
|
Add integrity with raid capability.
|
||||||
Fix support for lvconvert --repair used by foreign apps (i.e. Docker).
|
Fix support for lvconvert --repair used by foreign apps (i.e. Docker).
|
||||||
|
@ -7582,14 +7582,14 @@ int wipe_lv(struct logical_volume *lv, struct wipe_params wp)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (!lv_is_active(lv)) {
|
if (!lv_is_active(lv)) {
|
||||||
log_error("Volume \"%s/%s\" is not active locally (volume_list activation filter?).",
|
log_error("Volume %s is not active locally (volume_list activation filter?).",
|
||||||
lv->vg->name, lv->name);
|
display_lvname(lv));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait until devices are available */
|
/* Wait until devices are available */
|
||||||
if (!sync_local_dev_names(lv->vg->cmd)) {
|
if (!sync_local_dev_names(lv->vg->cmd)) {
|
||||||
log_error("Failed to sync local devices before wiping LV %s.",
|
log_error("Failed to sync local devices before wiping volume %s.",
|
||||||
display_lvname(lv));
|
display_lvname(lv));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -7613,17 +7613,20 @@ int wipe_lv(struct logical_volume *lv, struct wipe_params wp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!label_scan_open_rw(dev)) {
|
if (!label_scan_open_rw(dev)) {
|
||||||
log_error("Failed to open %s/%s for wiping and zeroing.", lv->vg->name, lv->name);
|
log_error("Failed to open %s for wiping and zeroing.", display_lvname(lv));
|
||||||
goto out;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wp.do_wipe_signatures) {
|
if (wp.do_wipe_signatures) {
|
||||||
log_verbose("Wiping known signatures on logical volume \"%s/%s\"",
|
log_verbose("Wiping known signatures on logical volume %s.",
|
||||||
lv->vg->name, lv->name);
|
display_lvname(lv));
|
||||||
if (!wipe_known_signatures(lv->vg->cmd, dev, name, 0,
|
if (!wipe_known_signatures(lv->vg->cmd, dev, name, 0,
|
||||||
TYPE_DM_SNAPSHOT_COW,
|
TYPE_DM_SNAPSHOT_COW,
|
||||||
wp.yes, wp.force, NULL))
|
wp.yes, wp.force, NULL)) {
|
||||||
stack;
|
log_error("Filed to wipe signatures of logical volume %s.",
|
||||||
|
display_lvname(lv));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wp.do_zero) {
|
if (wp.do_zero) {
|
||||||
@ -7632,21 +7635,23 @@ int wipe_lv(struct logical_volume *lv, struct wipe_params wp)
|
|||||||
if (zero_sectors > lv->size)
|
if (zero_sectors > lv->size)
|
||||||
zero_sectors = lv->size;
|
zero_sectors = lv->size;
|
||||||
|
|
||||||
log_verbose("Initializing %s of logical volume \"%s/%s\" with value %d.",
|
log_verbose("Initializing %s of logical volume %s with value %d.",
|
||||||
display_size(lv->vg->cmd, zero_sectors),
|
display_size(lv->vg->cmd, zero_sectors),
|
||||||
lv->vg->name, lv->name, wp.zero_value);
|
display_lvname(lv), wp.zero_value);
|
||||||
|
|
||||||
if (!wp.zero_value) {
|
if ((wp.zero_value && !dev_set_bytes(dev, UINT64_C(0),
|
||||||
if (!dev_write_zeros(dev, UINT64_C(0), (size_t) zero_sectors << SECTOR_SHIFT))
|
(size_t) zero_sectors << SECTOR_SHIFT,
|
||||||
stack;
|
(uint8_t)wp.zero_value)) ||
|
||||||
} else {
|
!dev_write_zeros(dev, UINT64_C(0), (size_t) zero_sectors << SECTOR_SHIFT)) {
|
||||||
if (!dev_set_bytes(dev, UINT64_C(0), (size_t) zero_sectors << SECTOR_SHIFT, (uint8_t)wp.zero_value))
|
log_error("Failed to initialize %s of logical volume %s with value %d.",
|
||||||
stack;
|
display_size(lv->vg->cmd, zero_sectors),
|
||||||
|
display_lvname(lv), wp.zero_value);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
label_scan_invalidate(dev);
|
label_scan_invalidate(dev);
|
||||||
out:
|
|
||||||
lv->status &= ~LV_NOSCAN;
|
lv->status &= ~LV_NOSCAN;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user