mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
wipe_lv: initially open LV in writable mode
wipe_lv knows it's going to write the device, so it can open rw from the start. It was opening readonly, and then dev_write needed to reopen it readwrite.
This commit is contained in:
parent
8fbaa6d9a5
commit
ccd1386070
@ -1272,6 +1272,18 @@ int label_scan_open_excl(struct device *dev)
|
|||||||
return label_scan_open(dev);
|
return label_scan_open(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int label_scan_open_rw(struct device *dev)
|
||||||
|
{
|
||||||
|
if (_in_bcache(dev) && !(dev->flags & DEV_BCACHE_WRITE)) {
|
||||||
|
/* FIXME: avoid tossing out bcache blocks just to replace fd. */
|
||||||
|
log_debug("Close and reopen rw %s", dev_name(dev));
|
||||||
|
bcache_invalidate_fd(scan_bcache, dev->bcache_fd);
|
||||||
|
_scan_dev_close(dev);
|
||||||
|
}
|
||||||
|
dev->flags |= DEV_BCACHE_WRITE;
|
||||||
|
return label_scan_open(dev);
|
||||||
|
}
|
||||||
|
|
||||||
bool dev_read_bytes(struct device *dev, uint64_t start, size_t len, void *data)
|
bool dev_read_bytes(struct device *dev, uint64_t start, size_t len, void *data)
|
||||||
{
|
{
|
||||||
if (!scan_bcache) {
|
if (!scan_bcache) {
|
||||||
|
@ -115,6 +115,7 @@ void label_scan_confirm(struct device *dev);
|
|||||||
int label_scan_setup_bcache(void);
|
int label_scan_setup_bcache(void);
|
||||||
int label_scan_open(struct device *dev);
|
int label_scan_open(struct device *dev);
|
||||||
int label_scan_open_excl(struct device *dev);
|
int label_scan_open_excl(struct device *dev);
|
||||||
|
int label_scan_open_rw(struct device *dev);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Wrappers around bcache equivalents.
|
* Wrappers around bcache equivalents.
|
||||||
|
@ -7365,7 +7365,7 @@ int wipe_lv(struct logical_volume *lv, struct wipe_params wp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!label_scan_open(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/%s for wiping and zeroing.", lv->vg->name, lv->name);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user