From f044f2d4d4f0808e73efe61ca0514d1a7f92c365 Mon Sep 17 00:00:00 2001 From: Will Shiu Date: Fri, 3 Jan 2020 16:05:00 +0800 Subject: [PATCH] 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 589b7dfd83a47eb0dbaa1f7bfa95b92c449f18c0) --- fs_mgr/fs_mgr.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp index b8385d335..e7ddf706e 100644 --- a/fs_mgr/fs_mgr.cpp +++ b/fs_mgr/fs_mgr.cpp @@ -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);