ksud: Don't umount stock bind mount, just bind it again after overlay.
This commit is contained in:
@@ -20,16 +20,10 @@ fn mount_partition(partition: &str, lowerdir: &mut Vec<String>) -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle stock mounts under /partition, we should restore the mount point after overlay
|
// handle stock mounts under /partition, we should restore the mount point after overlay
|
||||||
|
// because the overlayfs mount will "overlay" the bind mount such as /vendor/bt_firmware, /vendor/dsp
|
||||||
|
// which will cause the system bootloop or bluetooth/dsp not working
|
||||||
let stock_mount = mount::StockMount::new(&format!("/{partition}/"))
|
let stock_mount = mount::StockMount::new(&format!("/{partition}/"))
|
||||||
.with_context(|| format!("get stock mount of partition: {partition} failed"))?;
|
.with_context(|| format!("get stock mount of partition: {partition} failed"))?;
|
||||||
let result = stock_mount.umount();
|
|
||||||
if result.is_err() {
|
|
||||||
let remount_result = stock_mount.remount();
|
|
||||||
if let Err(e) = remount_result {
|
|
||||||
log::error!("remount stock failed: {:?}", e);
|
|
||||||
}
|
|
||||||
bail!("umount stock mount of failed: {:?}", result);
|
|
||||||
}
|
|
||||||
|
|
||||||
// add /partition as the lowerest dir
|
// add /partition as the lowerest dir
|
||||||
let lowest_dir = format!("/{partition}");
|
let lowest_dir = format!("/{partition}");
|
||||||
|
|||||||
@@ -284,21 +284,6 @@ impl StockMount {
|
|||||||
mounts
|
mounts
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn umount(&self) -> Result<()> {
|
|
||||||
let mounts = self.get_target_mounts();
|
|
||||||
log::info!("umount stock for {} : {:?}", self.mnt, mounts);
|
|
||||||
for m in mounts {
|
|
||||||
let dst = m
|
|
||||||
.dest
|
|
||||||
.to_str()
|
|
||||||
.ok_or(anyhow::anyhow!("Failed to get dst"))?;
|
|
||||||
umount_dir(dst)?;
|
|
||||||
log::info!("umount: {:?}", m);
|
|
||||||
}
|
|
||||||
log::info!("umount stock succeed!");
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn remount(&self) -> Result<()> {
|
pub fn remount(&self) -> Result<()> {
|
||||||
let mut mounts = self.get_target_mounts();
|
let mut mounts = self.get_target_mounts();
|
||||||
mounts.reverse(); // remount it in order
|
mounts.reverse(); // remount it in order
|
||||||
@@ -342,10 +327,6 @@ impl StockMount {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn umount(&self) -> Result<()> {
|
|
||||||
unimplemented!()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn remount(&self) -> Result<()> {
|
pub fn remount(&self) -> Result<()> {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user