fs_mgr: overlayfs: fsck scratch filesystem
Enable fsck phase for scratch filesystem. Solved a resulting
problem where the end of the fsck executable would result in a
SIGHUP to the caller.
Add some debugging details from adb-remount-test.sh script
Test: adb-remount-test.sh
Bug: 138577868
Bug: 139283818
Bug: 139226412
Change-Id: I129d86b7cf4e938001ba6db8d03247bc9903988d
diff --git a/fs_mgr/fs_mgr_overlayfs.cpp b/fs_mgr/fs_mgr_overlayfs.cpp
index 358c980..0579a3d 100644
--- a/fs_mgr/fs_mgr_overlayfs.cpp
+++ b/fs_mgr/fs_mgr_overlayfs.cpp
@@ -782,6 +782,7 @@
} else {
fs_mgr_set_blk_ro(device_path, false);
}
+ entry.fs_mgr_flags.check = true;
auto save_errno = errno;
auto mounted = fs_mgr_do_mount_one(entry) == 0;
if (!mounted) {
diff --git a/fs_mgr/tests/adb-remount-test.sh b/fs_mgr/tests/adb-remount-test.sh
index f445703..4226e95 100755
--- a/fs_mgr/tests/adb-remount-test.sh
+++ b/fs_mgr/tests/adb-remount-test.sh
@@ -38,6 +38,8 @@
EMPTY=""
SPACE=" "
+# Line up wrap to [ XXXXXXX ] messages.
+INDENT=" "
# A _real_ embedded tab character
TAB="`echo | tr '\n' '\t'`"
# A _real_ embedded escape character
@@ -159,8 +161,7 @@
return
fi
echo "${ORANGE}[ WARNING ]${NORMAL} unlabeled sepolicy violations:" >&2
- echo "${L}" |
- sed 's/^/ /' >&2
+ echo "${L}" | sed "s/^/${INDENT}/" >&2
}
[ "USAGE: get_property <prop>
@@ -639,10 +640,10 @@
*}" ]; then
echo "${prefix} expected \"${lval}\""
echo "${prefix} got \"${rval}\"" |
- sed ': again
+ sed ": again
N
- s/\(\n\)\([^ ]\)/\1 \2/
- t again'
+ s/\(\n\)\([^ ]\)/\1${INDENT}\2/
+ t again"
if [ -n "${*}" ] ; then
echo "${prefix} ${*}"
fi
@@ -657,10 +658,10 @@
if [ `echo ${lval}${rval}${*} | wc -c` -gt 60 -o "${rval}" != "${rval% *}" ]; then
echo "${prefix} ok \"${lval}\""
echo " = \"${rval}\"" |
- sed ': again
+ sed ": again
N
- s/\(\n\)\([^ ]\)/\1 \2/
- t again'
+ s/\(\n\)\([^ ]\)/\1${INDENT}\2/
+ t again"
if [ -n "${*}" ] ; then
echo "${prefix} ${*}"
fi
@@ -955,13 +956,24 @@
echo "${GREEN}[ RUN ]${NORMAL} Testing adb shell su root remount -R command" >&2
avc_check
- adb_su remount -R system </dev/null || true
+ T=`adb_date`
+ adb_su remount -R system </dev/null
+ err=${?}
+ if [ "${err}" != 0 ]; then
+ echo "${ORANGE}[ WARNING ]${NORMAL} adb shell su root remount -R system = ${err}, likely did not reboot!" >&2
+ T="-t ${T}"
+ else
+ # Rebooted, logcat will be meaningless, and last logcat will likely be clear
+ T=""
+ fi
sleep 2
adb_wait ${ADB_WAIT} ||
- die "waiting for device after remount -R `usb_status`"
+ die "waiting for device after adb shell su root remount -R system `usb_status`"
if [ "orange" != "`get_property ro.boot.verifiedbootstate`" -o \
"2" = "`get_property partition.system.verified`" ]; then
- die "remount -R command failed"
+ die ${T} "remount -R command failed
+${INDENT}ro.boot.verifiedbootstate=\"`get_property ro.boot.verifiedbootstate`\"
+${INDENT}partition.system.verified=\"`get_property partition.system.verified`\""
fi
echo "${GREEN}[ OK ]${NORMAL} adb shell su root remount -R command" >&2
@@ -1643,15 +1655,24 @@
if ${overlayfs_supported}; then
echo "${GREEN}[ RUN ]${NORMAL} test 'adb remount -R'" >&2
avc_check
- adb_root &&
- adb remount -R &&
- adb_wait ${ADB_WAIT} ||
- die "adb remount -R"
+ adb_root ||
+ die "adb root in preparation for adb remount -R"
+ T=`adb_date`
+ adb remount -R
+ err=${?}
+ if [ "${err}" != 0 ]; then
+ die -t ${T} "adb remount -R = ${err}"
+ fi
+ sleep 2
+ adb_wait ${ADB_WAIT} ||
+ die "waiting for device after adb remount -R `usb_status`"
if [ "orange" != "`get_property ro.boot.verifiedbootstate`" -o \
"2" = "`get_property partition.system.verified`" ] &&
[ -n "`get_property ro.boot.verifiedbootstate`" -o \
-n "`get_property partition.system.verified`" ]; then
- die "remount -R command failed to disable verity"
+ die "remount -R command failed to disable verity
+${INDENT}ro.boot.verifiedbootstate=\"`get_property ro.boot.verifiedbootstate`\"
+${INDENT}partition.system.verified=\"`get_property partition.system.verified`\""
fi
echo "${GREEN}[ OK ]${NORMAL} 'adb remount -R' command" >&2