mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
Fix LVM1 backwards compatibility issue when LV with a low LV number is deleted.
This commit is contained in:
parent
2a670fac46
commit
5f05971a84
@ -500,7 +500,7 @@ static int _write_lvd(struct device *dev, ulong pos, struct lv_disk *disk)
|
||||
static int _write_lvs(struct disk_list *data)
|
||||
{
|
||||
struct list *lvh;
|
||||
ulong pos;
|
||||
ulong pos, offset;
|
||||
|
||||
pos = data->pvd.lv_on_disk.base;
|
||||
|
||||
@ -513,10 +513,15 @@ static int _write_lvs(struct disk_list *data)
|
||||
list_iterate(lvh, &data->lvds) {
|
||||
struct lvd_list *ll = list_item(lvh, struct lvd_list);
|
||||
|
||||
if (!_write_lvd(data->dev, pos, &ll->lvd))
|
||||
fail;
|
||||
offset = sizeof(struct lv_disk) * ll->lvd.lv_number;
|
||||
if (offset + sizeof(struct lv_disk) >
|
||||
data->pvd.lv_on_disk.size) {
|
||||
log_error("lv_number %d too large", ll->lvd.lv_number);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pos += sizeof(struct lv_disk);
|
||||
if (!_write_lvd(data->dev, pos + offset, &ll->lvd))
|
||||
fail;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user