aboutsummaryrefslogtreecommitdiff
path: root/install
diff options
context:
space:
mode:
authorSimon Shields <simon@lineageos.org>2019-10-02 00:21:45 +1000
committerMichael Bestas <mkbestas@lineageos.org>2022-08-21 19:38:14 +0300
commit0242aa21a94c674390874a50158a5b99f2094562 (patch)
tree98c864ac898312c07d124b3b6128a96c64bebcda /install
parent11b1acf2aa9d2915b63fabd59c479a8137a403b7 (diff)
recovery_utils: add support for unmounting entire volumes
When wiping /system, the partition isn't actually mounted at /system or / - it's mounted at /mnt/system. This breaks 'format system' from recovery if the partition has been mounted. This patch adds an ensure_volume_unmounted function that finds all mounts of a given device and unmounts them, meaning the device can be safely formatted. Change-Id: Id4f727f845308a89e865f1ba60dc284f5ebc66e1
Diffstat (limited to 'install')
-rw-r--r--install/wipe_data.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/install/wipe_data.cpp b/install/wipe_data.cpp
index 024c1e1d..57565e24 100644
--- a/install/wipe_data.cpp
+++ b/install/wipe_data.cpp
@@ -47,7 +47,11 @@ static bool EraseVolume(const char* volume, RecoveryUI* ui) {
ui->Print("Formatting %s...\n", volume);
- ensure_path_unmounted(volume);
+ Volume* vol = volume_for_mount_point(volume);
+ if (ensure_volume_unmounted(vol->blk_device) == -1) {
+ PLOG(ERROR) << "Failed to unmount volume!";
+ return false;
+ }
int result = format_volume(volume);