From 5ced7600d106ed4f299d6abda071a48eeb7516cb Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Tue, 11 Feb 2020 07:52:18 -0800 Subject: [PATCH] fs_mgr: overlayfs: CreateDynamicScratch for *partition_exists Commit 69def12f08f576e824ba6ca13aeab668e49af87a ("overlayfs: Refactor how the scratch device is deduced, again.") introduced a regression which dropped a call to dm.GetDmDevicePathByName. The call was formerly done to check if a partition existed and shortcuted the logic. As a result when the partition exists and is already instantiated, CreateDynamicScratch function fails to fill out *scratch_device return value. The bandaid is to call GetBootScratchDevice() to leverage its own GetDmDevicePathByName call to fill out if it is detected as an empty value in CreateDynamicScratch, only called under this condition. Signed-off-by: Mark Salyzyn Test: adb-remount-test.sh Bug: 148881519 Change-Id: I40464e8dd17d25a292a275d0b9df5f9519b794fb --- fs_mgr/fs_mgr_overlayfs.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs_mgr/fs_mgr_overlayfs.cpp b/fs_mgr/fs_mgr_overlayfs.cpp index 2bc53d310..1fa1aa104 100644 --- a/fs_mgr/fs_mgr_overlayfs.cpp +++ b/fs_mgr/fs_mgr_overlayfs.cpp @@ -1026,6 +1026,8 @@ static bool CreateDynamicScratch(std::string* scratch_device, bool* partition_ex } if (change) *change = true; + } else if (scratch_device->empty()) { + *scratch_device = GetBootScratchDevice(); } return true; }