mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
wipe_lv: interruptible wiping
Since we now block signals and wiping may take unexpectedly long time - support breaking command while wipe is in progress.
This commit is contained in:
parent
e94e0cd020
commit
e9241860a8
@ -1,5 +1,6 @@
|
||||
Version 2.02.188 -
|
||||
==================================
|
||||
Support interruption when wipping LVs.
|
||||
Add configure --enable-editline support as an alternative to readline.
|
||||
Zero pool metadata on allocation (disable with allocation/zero_metadata=0).
|
||||
Failure in zeroing or wiping will fail command (bypass with -Zn, -Wn).
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "memlock.h"
|
||||
#include "lvmlockd.h"
|
||||
#include "label.h"
|
||||
#include "lvm-signal.h"
|
||||
|
||||
typedef enum {
|
||||
PREFERRED,
|
||||
@ -7225,12 +7226,20 @@ int wipe_lv(struct logical_volume *lv, struct wipe_params wp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
sigint_allow();
|
||||
if (wp.do_wipe_signatures) {
|
||||
log_verbose("Wiping known signatures on logical volume %s.",
|
||||
display_lvname(lv));
|
||||
if (!wipe_known_signatures(lv->vg->cmd, dev, name, 0,
|
||||
TYPE_DM_SNAPSHOT_COW,
|
||||
wp.yes, wp.force, NULL)) {
|
||||
sigint_restore();
|
||||
label_scan_invalidate(dev);
|
||||
if (sigint_caught()) {
|
||||
log_error("Interrupted initialization logical volume %s.",
|
||||
display_lvname(lv));
|
||||
return 0;
|
||||
}
|
||||
log_error("Filed to wipe signatures of logical volume %s.",
|
||||
display_lvname(lv));
|
||||
return 0;
|
||||
@ -7262,12 +7271,19 @@ int wipe_lv(struct logical_volume *lv, struct wipe_params wp)
|
||||
display_lvname(lv), wp.zero_value);
|
||||
|
||||
if (!dev_set_bytes(dev, UINT64_C(0), (size_t) zero_sectors << SECTOR_SHIFT, wp.zero_value)) {
|
||||
sigint_restore();
|
||||
if (sigint_caught()) {
|
||||
log_error("Interrupted initialization logical volume %s.",
|
||||
display_lvname(lv));
|
||||
return 0;
|
||||
}
|
||||
log_error("Failed to initialize %s of logical volume %s with value %d.",
|
||||
display_size(lv->vg->cmd, zero_sectors),
|
||||
display_lvname(lv), wp.zero_value);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
sigint_restore();
|
||||
|
||||
label_scan_invalidate(dev);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user