Mark source partition as writable before writing corrected bits am: cf29915f47
Original change: https://android-review.googlesource.com/c/platform/system/update_engine/+/2626759
Change-Id: I2c2119157733d99cc56a1cb91fb357b96d63e1c7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/payload_consumer/verified_source_fd.cc b/payload_consumer/verified_source_fd.cc
index f35b6a9..09ac95b 100644
--- a/payload_consumer/verified_source_fd.cc
+++ b/payload_consumer/verified_source_fd.cc
@@ -69,11 +69,16 @@
bool VerifiedSourceFd::WriteBackCorrectedSourceBlocks(
const std::vector<unsigned char>& source_data,
const google::protobuf::RepeatedPtrField<Extent>& extents) {
+ utils::SetBlockDeviceReadOnly(source_path_, false);
+ DEFER {
+ utils::SetBlockDeviceReadOnly(source_path_, true);
+ };
auto fd = std::make_shared<EintrSafeFileDescriptor>();
TEST_AND_RETURN_FALSE_ERRNO(fd->Open(source_path_.c_str(), O_RDWR));
DirectExtentWriter writer(fd);
TEST_AND_RETURN_FALSE(writer.Init(extents, block_size_));
- return writer.Write(source_data.data(), source_data.size());
+ TEST_AND_RETURN_FALSE(writer.Write(source_data.data(), source_data.size()));
+ return true;
}
FileDescriptorPtr VerifiedSourceFd::ChooseSourceFD(