fs_mgr: overlayfs: CreateDynamicScratch for *partition_exists

Commit 69def12f08
("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 <salyzyn@google.com>
Test: adb-remount-test.sh
Bug: 148881519
Change-Id: I40464e8dd17d25a292a275d0b9df5f9519b794fb
This commit is contained in:
Mark Salyzyn 2020-02-11 07:52:18 -08:00
parent cd8b982e40
commit 5ced7600d1

View file

@ -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;
}