fs_mgr: overlayfs: if existing scratch mountpoint is system_empty

On first mount check if overlays are setup, if not and there is
no space, then umount and make a filesystem and try again.

Test: adb_remount_test.sh
Bug: 119885423
Change-Id: I3a76ff5b53474976f72e9db326b26838f7df5ba8
This commit is contained in:
Mark Salyzyn 2019-01-04 14:43:27 -08:00
parent c08c8080ef
commit df8cf18804

View file

@ -751,8 +751,14 @@ bool fs_mgr_overlayfs_setup_scratch(const Fstab& fstab, bool* change) {
auto mnt_type = fs_mgr_overlayfs_scratch_mount_type();
if (partition_exists) {
if (fs_mgr_overlayfs_mount_scratch(scratch_device, mnt_type)) {
if (change) *change = true;
return true;
if (!fs_mgr_access(kScratchMountPoint + kOverlayTopDir) &&
!fs_mgr_filesystem_has_space(kScratchMountPoint)) {
// declare it useless, no overrides and no free space
fs_mgr_overlayfs_umount_scratch();
} else {
if (change) *change = true;
return true;
}
}
// partition existed, but was not initialized; fall through to make it.
errno = 0;