Run check_fs only /data is mounted

After switching to /system from ramdisk, first_stage_init has no required
libraries for check_fs.

[   20.838811][    T1] init: [libfs_mgr]Created logical partition scratch on device /dev/block/dm-6
[   20.972704][    T1] init: [libfs_mgr]Running /system/bin/fsck.f2fs -a -c 10000 --debug-cache /dev/block/dm-6
[   20.977879][  T345] logwrapper: executing /system/bin/fsck.f2fs failed: No such file or directory
[   20.978470][    T1] fsck.f2fs: executing /system/bin/fsck.f2fs failed: No such file or directory
[   20.981137][    T1] fsck.f2fs: fsck.f2fs terminated by exit(255)
[   21.002958][    T1] init: [libfs_mgr]__mount(source=/dev/block/dm-6,target=/mnt/scratch,type=f2fs)=0: Success
[   21.017748][    T1] init: [libfs_mgr]umount(/mnt/scratch)
[   21.021028][    T1] init: [libfs_mgr]Running /system/bin/fsck.f2fs -a -c 10000 --debug-cache /dev/block/dm-6
[   21.028759][  T347] logwrapper: executing /system/bin/fsck.f2fs failed: No such file or directory
[   21.028793][    T1] fsck.f2fs: executing /system/bin/fsck.f2fs failed: No such file or directory
[   21.049100][    T1] fsck.f2fs: fsck.f2fs terminated by exit(255)
[   21.068101][    T1] init: [libfs_mgr]__mount(source=/dev/block/dm-6,target=/mnt/scratch,type=f2fs)=0: Success

Bug: 210589189
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: Ie41cba4e7553860fdb48996d9b58a34093f0b723
This commit is contained in:
Jaegeuk Kim 2022-01-06 17:28:41 -08:00
parent d595de5139
commit 06db803f32
1 changed files with 4 additions and 1 deletions

View File

@ -882,7 +882,10 @@ bool fs_mgr_overlayfs_mount_scratch(const std::string& device_path, const std::s
entry.flags &= ~MS_RDONLY;
fs_mgr_set_blk_ro(device_path, false);
}
entry.fs_mgr_flags.check = true;
// check_fs requires apex runtime library
if (fs_mgr_overlayfs_already_mounted("/data", false)) {
entry.fs_mgr_flags.check = true;
}
auto save_errno = errno;
if (mounted) mounted = fs_mgr_do_mount_one(entry) == 0;
if (!mounted) {