Adding wait for a device file before mount

Adding the function, fs_mgr_wait_for_file(), to ensure the
device file exists before to mount

Bug: 158064601
Merged-In: I74a68224073932773be18a79f9334d83ea5b6947
Change-Id: I74a68224073932773be18a79f9334d83ea5b6947
(cherry picked from commit 589b7dfd83)
This commit is contained in:
Will Shiu 2020-01-03 16:05:00 +08:00 committed by Tom Cherry
parent b1df146aef
commit f044f2d4d4
1 changed files with 5 additions and 0 deletions

View File

@ -1757,6 +1757,11 @@ int fs_mgr_remount_userdata_into_checkpointing(Fstab* fstab) {
// wrapper to __mount() and expects a fully prepared fstab_rec,
// unlike fs_mgr_do_mount which does more things with avb / verity etc.
int fs_mgr_do_mount_one(const FstabEntry& entry, const std::string& mount_point) {
// First check the filesystem if requested.
if (entry.fs_mgr_flags.wait && !WaitForFile(entry.blk_device, 20s)) {
LERROR << "Skipping mounting '" << entry.blk_device << "'";
}
// Run fsck if needed
prepare_fs_for_mount(entry.blk_device, entry);