summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2018-07-31 16:20:02 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-07-31 16:20:02 +0000
commit4c87c1743efecaf992c7d0340041458f78fc9294 (patch)
tree84e0255129e123157439253e5bd7678ed6adeb67
parentd0d7d0a6b92221fcfb1ae772f7ae88280d5e3f6e (diff)
parent6dc508671bfd50ac92f71f4fc28c62eb308ad070 (diff)
downloadsystem_core-4c87c1743efecaf992c7d0340041458f78fc9294.tar.gz
system_core-4c87c1743efecaf992c7d0340041458f78fc9294.tar.bz2
system_core-4c87c1743efecaf992c7d0340041458f78fc9294.zip
Merge "adb: Correctly detect deduplicated ext4 partitions."
-rw-r--r--adb/daemon/remount_service.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/adb/daemon/remount_service.cpp b/adb/daemon/remount_service.cpp
index 658858717..0e79d824e 100644
--- a/adb/daemon/remount_service.cpp
+++ b/adb/daemon/remount_service.cpp
@@ -92,12 +92,13 @@ bool make_block_device_writable(const std::string& dev) {
return result;
}
-static bool fs_has_shared_blocks(const char* dev) {
+static bool fs_has_shared_blocks(const std::string& mount_point, const std::string& device) {
+ std::string path = mount_point + "/lost+found";
struct statfs fs;
- if (statfs(dev, &fs) == -1 || fs.f_type == EXT4_SUPER_MAGIC) {
+ if (statfs(path.c_str(), &fs) == -1 || fs.f_type != EXT4_SUPER_MAGIC) {
return false;
}
- unique_fd fd(unix_open(dev, O_RDONLY));
+ unique_fd fd(unix_open(device.c_str(), O_RDONLY));
if (fd < 0) {
return false;
}
@@ -237,7 +238,7 @@ void remount_service(unique_fd fd, const std::string& cmd) {
std::set<std::string> dedup;
for (const auto& partition : partitions) {
std::string dev = find_mount(partition.c_str(), partition == "/");
- if (dev.empty() || !fs_has_shared_blocks(dev.c_str())) {
+ if (dev.empty() || !fs_has_shared_blocks(partition, dev)) {
continue;
}
if (can_unshare_blocks(fd.get(), dev.c_str())) {