diff options
author | Kelvin Zhang <zhangkelvin@google.com> | 2021-05-07 14:43:04 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-05-07 14:43:04 +0000 |
commit | 5465b60e7b004ced480da2d6f5b47d49b3ca1611 (patch) | |
tree | ee2709f66298be280e0a51c524e2f2777e7dbbbe /payload_consumer/filesystem_verifier_action.cc | |
parent | e0042ab207ada8e6e8a8e1c84f478744d80f4810 (diff) | |
parent | 15242fd179cb779b1d59c891671a482c8983542a (diff) |
Fix verity discarded bug am: 9105f4baeb am: 15242fd179
Original change: https://android-review.googlesource.com/c/platform/system/update_engine/+/1686865
Change-Id: I763dabc5c8e66f2116a9e5630372a3488e1ceb03
Diffstat (limited to 'payload_consumer/filesystem_verifier_action.cc')
-rw-r--r-- | payload_consumer/filesystem_verifier_action.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/payload_consumer/filesystem_verifier_action.cc b/payload_consumer/filesystem_verifier_action.cc index 09dc638b..b14cbc8d 100644 --- a/payload_consumer/filesystem_verifier_action.cc +++ b/payload_consumer/filesystem_verifier_action.cc @@ -112,6 +112,14 @@ void FilesystemVerifierAction::Cleanup(ErrorCode code) { // This memory is not used anymore. buffer_.clear(); + // If we didn't write verity, partitions were maped. Releaase resource now. + if (!install_plan_.write_verity && + dynamic_control_->UpdateUsesSnapshotCompression()) { + LOG(INFO) << "Not writing verity and VABC is enabled, unmapping all " + "partitions"; + dynamic_control_->UnmapAllPartitions(); + } + if (cancelled_) return; if (code == ErrorCode::kSuccess && HasOutputPipe()) @@ -130,6 +138,21 @@ bool FilesystemVerifierAction::InitializeFdVABC() { const InstallPlan::Partition& partition = install_plan_.partitions[partition_index_]; + if (!ShouldWriteVerity()) { + // In VABC, if we are not writing verity, just map all partitions, + // and read using regular fd on |postinstall_mount_device| . + // All read will go through snapuserd, which provides a consistent + // view: device will use snapuserd to read partition during boot. + // b/186196758 + // Call UnmapAllPartitions() first, because if we wrote verity before, these + // writes won't be visible to previously opened snapuserd daemon. To ensure + // that we will see the most up to date data from partitions, call Unmap() + // then Map() to re-spin daemon. + dynamic_control_->UnmapAllPartitions(); + dynamic_control_->MapAllPartitions(); + return InitializeFd(partition.readonly_target_path); + } + // FilesystemVerifierAction need the read_fd_. partition_fd_ = dynamic_control_->OpenCowFd(partition.name, partition.source_path, true); |