Merge "MetadataCrypt: fix timeout due to missing userdata dm device"

This commit is contained in:
Treehugger Robot 2021-12-24 00:42:51 +00:00 committed by Gerrit Code Review
commit df2bc1025b

View file

@ -187,15 +187,14 @@ static bool create_crypto_blk_dev(const std::string& dm_name, const std::string&
auto& dm = DeviceMapper::Instance(); auto& dm = DeviceMapper::Instance();
if (dm_name == kDmNameUserdata && dm.GetState(dm_name) == DmDeviceState::SUSPENDED) { if (dm_name == kDmNameUserdata && dm.GetState(dm_name) == DmDeviceState::SUSPENDED) {
// The device was created in advance, populate it now. // The device was created in advance, populate it now.
std::string path;
if (!dm.WaitForDevice(dm_name, 5s, crypto_blkdev)) {
LOG(ERROR) << "Failed to wait for default-key device " << dm_name;
return false;
}
if (!dm.LoadTableAndActivate(dm_name, table)) { if (!dm.LoadTableAndActivate(dm_name, table)) {
LOG(ERROR) << "Failed to populate default-key device " << dm_name; LOG(ERROR) << "Failed to populate default-key device " << dm_name;
return false; return false;
} }
if (!dm.WaitForDevice(dm_name, 5s, crypto_blkdev)) {
LOG(ERROR) << "Failed to wait for default-key device " << dm_name;
return false;
}
} else if (!dm.CreateDevice(dm_name, table, crypto_blkdev, 5s)) { } else if (!dm.CreateDevice(dm_name, table, crypto_blkdev, 5s)) {
LOG(ERROR) << "Could not create default-key device " << dm_name; LOG(ERROR) << "Could not create default-key device " << dm_name;
return false; return false;