Merge changes I72aaf4d6,I420cb87c,Iab7c6cf7,Ic4388e20 am: 39624169e7 am: 6a47ef32db
am: d4dd92821d
Change-Id: Ia7bdb461c9157a510fcd113cb02b5b10f99c37d5
diff --git a/fs_mgr/fs_mgr_overlayfs.cpp b/fs_mgr/fs_mgr_overlayfs.cpp
index 3908683..2c4299a 100644
--- a/fs_mgr/fs_mgr_overlayfs.cpp
+++ b/fs_mgr/fs_mgr_overlayfs.cpp
@@ -626,8 +626,8 @@
// Only a suggestion for _first_ try during mounting
std::string fs_mgr_overlayfs_scratch_mount_type() {
- if (!access(kMkF2fs.c_str(), X_OK)) return "f2fs";
- if (!access(kMkExt4.c_str(), X_OK)) return "ext4";
+ if (!access(kMkF2fs.c_str(), X_OK) && fs_mgr_access("/sys/fs/f2fs")) return "f2fs";
+ if (!access(kMkExt4.c_str(), X_OK) && fs_mgr_access("/sys/fs/ext4")) return "ext4";
return "auto";
}
@@ -642,7 +642,11 @@
// Create from within single super device;
auto& dm = DeviceMapper::Instance();
const auto partition_name = android::base::Basename(kScratchMountPoint);
- if (!dm.GetDmDevicePathByName(partition_name, &path)) return "";
+ if (!dm.GetDmDevicePathByName(partition_name, &path)) {
+ // non-DAP A/B device?
+ if (fs_mgr_access(super_device)) return "";
+ path = kPhysicalDevice + "system" + (slot_number ? "_a" : "_b");
+ }
}
return scratch_device_cache = path;
}
@@ -829,8 +833,9 @@
true /* readonly */)) {
auto has_overlayfs_dir = fs_mgr_access(kScratchMountPoint + kOverlayTopDir);
fs_mgr_overlayfs_umount_scratch();
- if (has_overlayfs_dir)
+ if (has_overlayfs_dir) {
fs_mgr_overlayfs_mount_scratch(scratch_device, mount_type);
+ }
}
}
}
@@ -882,10 +887,6 @@
for (const auto& overlay_mount_point : kOverlayMountPoints) {
if (backing && backing[0] && (overlay_mount_point != backing)) continue;
if (overlay_mount_point == kScratchMountPoint) {
- if (!fs_mgr_rw_access(fs_mgr_overlayfs_super_device(fs_mgr_overlayfs_slot_number())) ||
- !fs_mgr_overlayfs_has_logical(fstab)) {
- continue;
- }
if (!fs_mgr_overlayfs_setup_scratch(fstab, change)) continue;
} else {
if (std::find_if(fstab.begin(), fstab.end(), [&overlay_mount_point](const auto& entry) {
diff --git a/fs_mgr/tests/adb-remount-test.sh b/fs_mgr/tests/adb-remount-test.sh
index 0765f04..42f3f29 100755
--- a/fs_mgr/tests/adb-remount-test.sh
+++ b/fs_mgr/tests/adb-remount-test.sh
@@ -309,7 +309,7 @@
-e "^\(overlay\|tmpfs\|none\|sysfs\|proc\|selinuxfs\|debugfs\) " \
-e "^\(bpf\|cg2_bpf\|pstore\|tracefs\|adb\|mtp\|ptp\|devpts\) " \
-e "^\(/data/media\|/dev/block/loop[0-9]*\) " \
- -e " /\(cache\|mnt/scratch\|mnt/vendor/persist\|metadata\) "
+ -e " /\(cache\|mnt/scratch\|mnt/vendor/persist\|persist\|metadata\) "
}
if [ X"-s" = X"${1}" -a -n "${2}" ]; then
@@ -403,9 +403,15 @@
echo "${D}" | grep -v /dev/root`
fi
D=`echo "${D}" | cut -s -d' ' -f1 | sort -u`
+no_dedupe=true
+for d in ${D}; do
+ adb_sh tune2fs -l $d 2>&1 |
+ grep "Filesystem features:.*shared_blocks" >/dev/null &&
+ no_dedupe=false
+done
D=`adb_sh df -k ${D} </dev/null`
echo "${D}"
-if [ X"${D}" = X"${D##* 100[%] }" ]; then
+if [ X"${D}" = X"${D##* 100[%] }" ] && ${no_dedupe} ; then
overlayfs_needed=false
elif ! ${overlayfs_supported}; then
die "need overlayfs, but do not have it"
@@ -597,6 +603,7 @@
echo "${GREEN}[ RUN ]${NORMAL} flash vendor, confirm its content disappears" >&2
H=`adb_sh echo '${HOSTNAME}' </dev/null 2>/dev/null`
+is_userspace_fastboot=false
if [ -z "${ANDROID_PRODUCT_OUT}" ]; then
echo "${ORANGE}[ WARNING ]${NORMAL} build tree not setup, skipping"
elif [ ! -s "${ANDROID_PRODUCT_OUT}/vendor.img" ]; then
@@ -609,6 +616,8 @@
fastboot flash vendor ||
( fastboot reboot && false) ||
die "fastboot flash vendor"
+ fastboot_getvar is-userspace yes &&
+ is_userspace_fastboot=true
if [ -n "${scratch_paritition}" ]; then
fastboot_getvar partition-type:${scratch_partition} raw ||
( fastboot reboot && false) ||
@@ -654,7 +663,12 @@
echo "${D}" | grep "^overlay .* /system\$" >/dev/null ||
die "overlay /system takeover after flash vendor"
echo "${D}" | grep "^overlay .* /vendor\$" >/dev/null &&
- die "overlay supposed to be minus /vendor takeover after flash vendor"
+ if ${is_userspace_fastboot}; then
+ die "overlay supposed to be minus /vendor takeover after flash vendor"
+ else
+ echo "${ORANGE}[ WARNING ]${NORMAL} user fastboot missing, ignoring a failure"
+ ( die "overlay supposed to be minus /vendor takeover after flash vendor" )
+ fi
fi
B="`adb_cat /system/hello`" ||
die "re-read /system/hello after flash vendor"
@@ -662,8 +676,17 @@
adb_root ||
die "adb root"
B="`adb_cat /vendor/hello`" &&
- die "re-read /vendor/hello after flash vendor"
- check_eq "cat: /vendor/hello: No such file or directory" "${B}" vendor after flash vendor
+ if ${is_userspace_fastboot} || ! ${overlayfs_needed}; then
+ die "re-read /vendor/hello after flash vendor"
+ else
+ echo "${ORANGE}[ WARNING ]${NORMAL} user fastboot missing, ignoring a failure"
+ ( die "re-read /vendor/hello after flash vendor" )
+ fi
+ if ${is_userspace_fastboot} || ! ${overlayfs_needed}; then
+ check_eq "cat: /vendor/hello: No such file or directory" "${B}" vendor after flash vendor
+ else
+ ( check_eq "cat: /vendor/hello: No such file or directory" "${B}" vendor after flash vendor )
+ fi
fi
echo "${GREEN}[ RUN ]${NORMAL} remove test content (cleanup)" >&2