Revert "libsnapshot: Fix libsnapshot_fuzzer_test."

Revert submission 1935201

Reason for revert: DroidMonitor: Potential culprit for Bug http://b/213259099 - verifying through Forrest before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.
Reverted Changes:
I219f956ba:libsnapshot: Fix libsnapshot_fuzzer_test.
I281937e26:libsnapshot: Fix checks for compression to work wi...

Change-Id: I33731556761cbdf603424fda94117973d3f21e21
This commit is contained in:
Rafay Kamran 2022-01-05 10:10:51 +00:00
parent fe9b4ed7b8
commit f140d4d584
8 changed files with 16 additions and 25 deletions

View file

@ -19,8 +19,6 @@
#include <fs_mgr_overlayfs.h>
#include <libfiemap/image_manager.h>
#include "utility.h"
namespace android {
namespace snapshot {
@ -145,9 +143,5 @@ android::dm::IDeviceMapper& DeviceInfo::GetDeviceMapper() {
return android::dm::DeviceMapper::Instance();
}
bool DeviceInfo::UseUserspaceSnapshots() const {
return IsUserspaceSnapshotsEnabled();
}
} // namespace snapshot
} // namespace android

View file

@ -41,7 +41,6 @@ class DeviceInfo final : public SnapshotManager::IDeviceInfo {
std::unique_ptr<IImageManager> OpenImageManager() const override;
bool IsFirstStageInit() const override;
android::dm::IDeviceMapper& GetDeviceMapper() override;
bool UseUserspaceSnapshots() const override;
void set_first_stage_init(bool value) { first_stage_init_ = value; }

View file

@ -34,7 +34,6 @@ class MockDeviceInfo : public SnapshotManager::IDeviceInfo {
MOCK_METHOD(bool, IsFirstStageInit, (), (const, override));
MOCK_METHOD(std::unique_ptr<android::fiemap::IImageManager>, OpenImageManager, (),
(const, override));
MOCK_METHOD(bool, UseUserspaceSnapshots, (), (const, override));
};
} // namespace android::snapshot

View file

@ -111,7 +111,6 @@ class ISnapshotManager {
virtual bool IsFirstStageInit() const = 0;
virtual std::unique_ptr<IImageManager> OpenImageManager() const = 0;
virtual android::dm::IDeviceMapper& GetDeviceMapper() = 0;
virtual bool UseUserspaceSnapshots() const = 0;
// Helper method for implementing OpenImageManager.
std::unique_ptr<IImageManager> OpenImageManager(const std::string& gsid_dir) const;

View file

@ -107,7 +107,6 @@ class TestDeviceInfo : public SnapshotManager::IDeviceInfo {
}
bool IsSlotUnbootable(uint32_t slot) { return unbootable_slots_.count(slot) != 0; }
bool UseUserspaceSnapshots() const override;
void set_slot_suffix(const std::string& suffix) { slot_suffix_ = suffix; }
void set_fake_super(const std::string& path) {

View file

@ -3134,15 +3134,14 @@ Return SnapshotManager::CreateUpdateSnapshots(const DeltaArchiveManifest& manife
.compression_algorithm = compression_algorithm,
};
cow_creator.userspace_snapshots_enabled = device_->UseUserspaceSnapshots();
if (cow_creator.userspace_snapshots_enabled) {
LOG(INFO) << "User-space snapshots enabled, compression = " << compression_algorithm;
} else {
LOG(INFO) << "User-space snapshots disabled, compression = " << compression_algorithm;
}
is_snapshot_userspace_ = cow_creator.userspace_snapshots_enabled;
if (!device()->IsTestDevice()) {
cow_creator.userspace_snapshots_enabled = IsUserspaceSnapshotsEnabled();
if (cow_creator.userspace_snapshots_enabled) {
LOG(INFO) << "User-space snapshots enabled";
} else {
LOG(INFO) << "User-space snapshots disabled";
}
if ((use_compression || is_snapshot_userspace_) && !device()->IsTestDevice()) {
// Terminate stale daemon if any
std::unique_ptr<SnapuserdClient> snapuserd_client =
SnapuserdClient::Connect(kSnapuserdSocket, 10s);
@ -3157,8 +3156,17 @@ Return SnapshotManager::CreateUpdateSnapshots(const DeltaArchiveManifest& manife
snapuserd_client_->CloseConnection();
snapuserd_client_ = nullptr;
}
} else {
cow_creator.userspace_snapshots_enabled = !IsDmSnapshotTestingEnabled();
if (cow_creator.userspace_snapshots_enabled) {
LOG(INFO) << "User-space snapshots disabled for testing";
} else {
LOG(INFO) << "User-space snapshots enabled for testing";
}
}
is_snapshot_userspace_ = cow_creator.userspace_snapshots_enabled;
// If compression is enabled, we need to retain a copy of the old metadata
// so we can access original blocks in case they are moved around. We do
// not want to rely on the old super metadata slot because we don't

View file

@ -130,7 +130,6 @@ class SnapshotFuzzDeviceInfo : public ISnapshotManager::IDeviceInfo {
std::unique_ptr<IImageManager> OpenImageManager() const {
return env_->CheckCreateFakeImageManager();
}
bool UseUserspaceSnapshots() const override { return false; }
void SwitchSlot() { switched_slot_ = !switched_slot_; }

View file

@ -25,8 +25,6 @@
#include <openssl/sha.h>
#include <payload_consumer/file_descriptor.h>
#include "utility.h"
namespace android {
namespace snapshot {
@ -322,9 +320,5 @@ bool IsVirtualAbEnabled() {
return android::base::GetBoolProperty("ro.virtual_ab.enabled", false);
}
bool TestDeviceInfo::UseUserspaceSnapshots() const {
return !IsDmSnapshotTestingEnabled();
}
} // namespace snapshot
} // namespace android