@@ -583,18 +583,21 @@ impl Drop for MountGuard {
583583 if self . unmounted . load ( Ordering :: Acquire ) {
584584 return ;
585585 }
586- let mount_id = self . mount_id . clone ( ) ;
587- let task_id: String = self . task_id . clone ( ) ;
588- // Spawn a task to handle the unmounting asynchronously
589- // Since the unmount operation is idempotent, it's safe to perform asynchronously
590- // even if the spawned task doesn't complete before program exit.
591- // Multiple calls to unmount the same mount_id should be safe and have no side effects.
592- tokio:: spawn ( async move {
593- match unmount_antares_fs ( & mount_id) . await {
594- Ok ( _) => tracing:: info!( "[Task {}] Filesystem unmounted successfully." , task_id) ,
595- Err ( e) => tracing:: error!( "[Task {}] Failed to unmount filesystem: {}" , task_id, e) ,
596- }
597- } ) ;
586+ // TODO: Temporarily keep mounts alive — skip auto-unmount on drop.
587+ // Re-enable the spawn block below once post-build inspection is no longer needed.
588+ tracing:: info!(
589+ "[Task {}] MountGuard dropped but unmount is temporarily disabled (mount_id={})." ,
590+ self . task_id,
591+ self . mount_id,
592+ ) ;
593+ // let mount_id = self.mount_id.clone();
594+ // let task_id: String = self.task_id.clone();
595+ // tokio::spawn(async move {
596+ // match unmount_antares_fs(&mount_id).await {
597+ // Ok(_) => tracing::info!("[Task {}] Filesystem unmounted successfully.", task_id),
598+ // Err(e) => tracing::error!("[Task {}] Failed to unmount filesystem: {}", task_id, e),
599+ // }
600+ // });
598601 }
599602}
600603
@@ -640,6 +643,7 @@ pub async fn build(
640643
641644 const MAX_TARGETS_ATTEMPTS : usize = 2 ;
642645 let mut mount_point = None ;
646+ let mut old_repo_mount_point_saved = None ;
643647 let mut mount_guard = None ;
644648 let mut mount_guard_old_repo = None ;
645649 let mut targets: Vec < TargetLabel > = Vec :: new ( ) ;
@@ -686,6 +690,7 @@ pub async fn build(
686690 {
687691 Ok ( found_targets) => {
688692 mount_point = Some ( repo_mount_point) ;
693+ old_repo_mount_point_saved = Some ( old_repo_mount_point. clone ( ) ) ;
689694 mount_guard = Some ( guard) ;
690695 mount_guard_old_repo = Some ( guard_old_repo) ;
691696 targets = found_targets;
@@ -834,8 +839,25 @@ pub async fn build(
834839 }
835840 . await ;
836841
837- mount_guard. unmount ( ) . await ;
838- mount_guard_old_repo. unmount ( ) . await ;
842+ // TODO: Temporarily keep mounts alive for debugging / post-build inspection.
843+ // Unmount is intentionally skipped here. Remember to re-enable once no longer needed.
844+ // mount_guard.unmount().await;
845+ // mount_guard_old_repo.unmount().await;
846+ tracing:: info!(
847+ "[Task {}] Skipping unmount — mount directories are retained for inspection: \
848+ new_repo mountpoint={}, mount_id={}; \
849+ old_repo mountpoint={}, mount_id={}",
850+ id,
851+ mount_point,
852+ mount_guard. mount_id,
853+ old_repo_mount_point_saved. as_deref( ) . unwrap_or( "<unknown>" ) ,
854+ mount_guard_old_repo. mount_id,
855+ ) ;
856+ // Prevent the Drop impl from unmounting.
857+ mount_guard. unmounted . store ( true , Ordering :: Release ) ;
858+ mount_guard_old_repo
859+ . unmounted
860+ . store ( true , Ordering :: Release ) ;
839861
840862 build_result
841863}
0 commit comments