Don't call block checkpoint functions above dm-default-key
Bug: 156225476 Test: Build for f2fs and ext4 device, make sure checkpoints roll back and commit Change-Id: I7a772ff712dec9e69df175de840d69d296c65923
This commit is contained in:
parent
220b6ebd05
commit
2055364f83
|
@ -1014,7 +1014,8 @@ static bool SupportsCheckpoint(FstabEntry* entry) {
|
||||||
|
|
||||||
class CheckpointManager {
|
class CheckpointManager {
|
||||||
public:
|
public:
|
||||||
CheckpointManager(int needs_checkpoint = -1) : needs_checkpoint_(needs_checkpoint) {}
|
CheckpointManager(int needs_checkpoint = -1, bool metadata_encrypted = false)
|
||||||
|
: needs_checkpoint_(needs_checkpoint), metadata_encrypted_(metadata_encrypted) {}
|
||||||
|
|
||||||
bool NeedsCheckpoint() {
|
bool NeedsCheckpoint() {
|
||||||
if (needs_checkpoint_ != UNKNOWN) {
|
if (needs_checkpoint_ != UNKNOWN) {
|
||||||
|
@ -1032,7 +1033,7 @@ class CheckpointManager {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry->fs_mgr_flags.checkpoint_blk) {
|
if (entry->fs_mgr_flags.checkpoint_blk && !metadata_encrypted_) {
|
||||||
call_vdc({"checkpoint", "restoreCheckpoint", entry->blk_device}, nullptr);
|
call_vdc({"checkpoint", "restoreCheckpoint", entry->blk_device}, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1121,6 +1122,7 @@ class CheckpointManager {
|
||||||
|
|
||||||
enum { UNKNOWN = -1, NO = 0, YES = 1 };
|
enum { UNKNOWN = -1, NO = 0, YES = 1 };
|
||||||
int needs_checkpoint_;
|
int needs_checkpoint_;
|
||||||
|
bool metadata_encrypted_;
|
||||||
std::map<std::string, std::string> device_map_;
|
std::map<std::string, std::string> device_map_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1685,11 +1687,11 @@ int fs_mgr_do_mount_one(const FstabEntry& entry, const std::string& mount_point)
|
||||||
// in turn, and stop on 1st success, or no more match.
|
// in turn, and stop on 1st success, or no more match.
|
||||||
static int fs_mgr_do_mount_helper(Fstab* fstab, const std::string& n_name,
|
static int fs_mgr_do_mount_helper(Fstab* fstab, const std::string& n_name,
|
||||||
const std::string& n_blk_device, const char* tmp_mount_point,
|
const std::string& n_blk_device, const char* tmp_mount_point,
|
||||||
int needs_checkpoint) {
|
int needs_checkpoint, bool metadata_encrypted) {
|
||||||
int mount_errors = 0;
|
int mount_errors = 0;
|
||||||
int first_mount_errno = 0;
|
int first_mount_errno = 0;
|
||||||
std::string mount_point;
|
std::string mount_point;
|
||||||
CheckpointManager checkpoint_manager(needs_checkpoint);
|
CheckpointManager checkpoint_manager(needs_checkpoint, metadata_encrypted);
|
||||||
AvbUniquePtr avb_handle(nullptr);
|
AvbUniquePtr avb_handle(nullptr);
|
||||||
|
|
||||||
if (!fstab) {
|
if (!fstab) {
|
||||||
|
@ -1799,12 +1801,13 @@ static int fs_mgr_do_mount_helper(Fstab* fstab, const std::string& n_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
int fs_mgr_do_mount(Fstab* fstab, const char* n_name, char* n_blk_device, char* tmp_mount_point) {
|
int fs_mgr_do_mount(Fstab* fstab, const char* n_name, char* n_blk_device, char* tmp_mount_point) {
|
||||||
return fs_mgr_do_mount_helper(fstab, n_name, n_blk_device, tmp_mount_point, -1);
|
return fs_mgr_do_mount_helper(fstab, n_name, n_blk_device, tmp_mount_point, -1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int fs_mgr_do_mount(Fstab* fstab, const char* n_name, char* n_blk_device, char* tmp_mount_point,
|
int fs_mgr_do_mount(Fstab* fstab, const char* n_name, char* n_blk_device, char* tmp_mount_point,
|
||||||
bool needs_checkpoint) {
|
bool needs_checkpoint, bool metadata_encrypted) {
|
||||||
return fs_mgr_do_mount_helper(fstab, n_name, n_blk_device, tmp_mount_point, needs_checkpoint);
|
return fs_mgr_do_mount_helper(fstab, n_name, n_blk_device, tmp_mount_point, needs_checkpoint,
|
||||||
|
metadata_encrypted);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -69,7 +69,7 @@ int fs_mgr_mount_all(android::fs_mgr::Fstab* fstab, int mount_mode);
|
||||||
int fs_mgr_do_mount(android::fs_mgr::Fstab* fstab, const char* n_name, char* n_blk_device,
|
int fs_mgr_do_mount(android::fs_mgr::Fstab* fstab, const char* n_name, char* n_blk_device,
|
||||||
char* tmp_mount_point);
|
char* tmp_mount_point);
|
||||||
int fs_mgr_do_mount(android::fs_mgr::Fstab* fstab, const char* n_name, char* n_blk_device,
|
int fs_mgr_do_mount(android::fs_mgr::Fstab* fstab, const char* n_name, char* n_blk_device,
|
||||||
char* tmp_mount_point, bool need_cp);
|
char* tmp_mount_point, bool need_cp, bool metadata_encrypted);
|
||||||
int fs_mgr_do_mount_one(const android::fs_mgr::FstabEntry& entry,
|
int fs_mgr_do_mount_one(const android::fs_mgr::FstabEntry& entry,
|
||||||
const std::string& mount_point = "");
|
const std::string& mount_point = "");
|
||||||
int fs_mgr_do_tmpfs_mount(const char *n_name);
|
int fs_mgr_do_tmpfs_mount(const char *n_name);
|
||||||
|
|
Loading…
Reference in New Issue