Merge "fs_mgr: overlayfs: check if scratch device is ext4 dedupe" am: a22e74cd4e

Original change: https://android-review.googlesource.com/c/platform/system/core/+/1234486

Change-Id: I493d05c652ac85f07032f5fabe38b80a93fa89d4
This commit is contained in:
Treehugger Robot 2020-07-17 19:35:00 +00:00 committed by Automerger Merge Worker
commit d84ccd640b

View file

@ -809,15 +809,26 @@ bool fs_mgr_overlayfs_mount_scratch(const std::string& device_path, const std::s
entry.fs_type = mnt_type; entry.fs_type = mnt_type;
if ((mnt_type == "f2fs") && !f2fs) entry.fs_type = "ext4"; if ((mnt_type == "f2fs") && !f2fs) entry.fs_type = "ext4";
if ((mnt_type == "ext4") && !ext4) entry.fs_type = "f2fs"; if ((mnt_type == "ext4") && !ext4) entry.fs_type = "f2fs";
entry.flags = MS_NOATIME; entry.flags = MS_NOATIME | MS_RDONLY;
if (readonly) { auto mounted = true;
entry.flags |= MS_RDONLY; if (!readonly) {
} else { if (entry.fs_type == "ext4") {
// check if ext4 de-dupe
entry.flags |= MS_RDONLY;
auto save_errno = errno;
mounted = fs_mgr_do_mount_one(entry) == 0;
if (mounted) {
mounted = !fs_mgr_has_shared_blocks(entry.mount_point, entry.blk_device);
fs_mgr_overlayfs_umount_scratch();
}
errno = save_errno;
}
entry.flags &= ~MS_RDONLY;
fs_mgr_set_blk_ro(device_path, false); fs_mgr_set_blk_ro(device_path, false);
} }
entry.fs_mgr_flags.check = true; entry.fs_mgr_flags.check = true;
auto save_errno = errno; auto save_errno = errno;
auto mounted = fs_mgr_do_mount_one(entry) == 0; if (mounted) mounted = fs_mgr_do_mount_one(entry) == 0;
if (!mounted) { if (!mounted) {
if ((entry.fs_type == "f2fs") && ext4) { if ((entry.fs_type == "f2fs") && ext4) {
entry.fs_type = "ext4"; entry.fs_type = "ext4";