Implementation of tapdisk_vbd_reactivate_volumes follows the vhd
parent chain, but therein lacks a critical check matching child and
parent uuids.
This creates a race window wherein reactivation hits an lv resize on
the master. The new last sector, while unrewritten, may carry garbage
footers. Results may vary, from plain reactivation failures to chain
traversal running off into the weeds.
Fixed with a proper uuid check. Adds some eprintfs to aid debugging
the corner cases.
char *name, *new;
vhd_context_t vhd;
vhd_parent_locator_t *loc;
+ uuid_t prt_uuid;
new = NULL;
name = NULL;
for (i = 0; i < TD_VBD_EIO_RETRIES; i++) {
err = vhd_open(&vhd, name, VHD_OPEN_RDONLY);
+ if (!err && cnt > 0) {
+ err = uuid_compare(vhd.footer.uuid, prt_uuid);
+ if (err) {
+ EPRINTF("child/parent uuid mismatch");
+ err = -EINVAL;
+ }
+ }
if (!err)
break;
break;
}
+ uuid_copy(prt_uuid, vhd.header.prt_uuid);
+
loc = NULL;
for (i = 0; i < 8; i++)
if (vhd.header.loc[i].code == PLAT_CODE_MACX) {
}
if (!loc) {
+ EPRINTF("failed to find parent locator");
vhd_close(&vhd);
err = -EINVAL;
goto fail;
vhd_close(&vhd);
if (err) {
+ EPRINTF("failed to read parent locator");
name = NULL;
goto fail;
}