fastbootd: sync() after flashing partitions or updating super
There is a chance that devices are failing to reboot in the lab due to sync() taking explicitly long during reboot. Let's add the sync()'s here to ensure they get accounted for in the flashing process. A side benefit is it's likely safer to sync immediately after flashing than to hope init does it during reboot. Bug: 150863651 Test: flash local devices successfully Change-Id: I4c4b0114f3cde8af4b8b2cb283ec21f869ef9f6f
This commit is contained in:
parent
db22f23dd3
commit
e4a6ed8534
1 changed files with 5 additions and 1 deletions
|
@ -135,7 +135,9 @@ int Flash(FastbootDevice* device, const std::string& partition_name) {
|
|||
return -EOVERFLOW;
|
||||
}
|
||||
WipeOverlayfsForPartition(device, partition_name);
|
||||
return FlashBlockDevice(handle.fd(), data);
|
||||
int result = FlashBlockDevice(handle.fd(), data);
|
||||
sync();
|
||||
return result;
|
||||
}
|
||||
|
||||
bool UpdateSuper(FastbootDevice* device, const std::string& super_name, bool wipe) {
|
||||
|
@ -165,6 +167,7 @@ bool UpdateSuper(FastbootDevice* device, const std::string& super_name, bool wip
|
|||
return device->WriteFail("Unable to flash new partition table");
|
||||
}
|
||||
fs_mgr_overlayfs_teardown();
|
||||
sync();
|
||||
return device->WriteOkay("Successfully flashed partition table");
|
||||
}
|
||||
|
||||
|
@ -204,5 +207,6 @@ bool UpdateSuper(FastbootDevice* device, const std::string& super_name, bool wip
|
|||
return device->WriteFail("Unable to write new partition table");
|
||||
}
|
||||
fs_mgr_overlayfs_teardown();
|
||||
sync();
|
||||
return device->WriteOkay("Successfully updated partition table");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue