mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Wipe the first label if writing the second one failed.
This commit is contained in:
parent
e8bacbc465
commit
8cdf0a831c
@ -267,8 +267,16 @@ int label_write(struct device *dev, struct label *label)
|
||||
/* Write another at the end of the device */
|
||||
status2 = dev_write(dev, offset[1], sizeof(struct label_ondisk) + label->datalen, block);
|
||||
if (!status2)
|
||||
{
|
||||
char zerobuf[sizeof(struct label_ondisk)];
|
||||
log_error("Error writing label 2\n");
|
||||
|
||||
/* Wipe the first label so it doesn't get confusing */
|
||||
memset(zerobuf, 0, sizeof(struct label_ondisk));
|
||||
if (!dev_write(dev, offset[0], sizeof(struct label_ondisk), zerobuf))
|
||||
log_error("Error erasing label 1\n");
|
||||
}
|
||||
|
||||
pool_free(label_pool, block);
|
||||
dev_close(dev);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user