diff options
author | Kelvin Zhang <zhangkelvin@google.com> | 2021-05-07 15:06:39 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-05-07 15:06:39 +0000 |
commit | 70a2cda2632defdffdfed765f09e2788dc199555 (patch) | |
tree | 0b7e82bc63ca825711d8836e8cf51d8232971281 /payload_consumer/filesystem_verifier_action.cc | |
parent | 27578a724282f105467c941c472a90e4b271c86d (diff) | |
parent | 5465b60e7b004ced480da2d6f5b47d49b3ca1611 (diff) |
Fix verity discarded bug am: 9105f4baeb am: 15242fd179 am: 5465b60e7b
Original change: https://android-review.googlesource.com/c/platform/system/update_engine/+/1686865
Change-Id: I3012b932910d78275c91559a3b3ddcb1032746e3
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); |