From e3ca41a79ef7584f33a72247c53b7107040e0f57 Mon Sep 17 00:00:00 2001 From: jakub961241 <144362244+jakub961241@users.noreply.github.com> Date: Sun, 22 Mar 2026 01:51:15 +0100 Subject: [PATCH] fix: container backup should not fail entirely on mount copy errors (#12236) When backing up a container with large mounted directories, if the copy fails (e.g., insufficient disk space), the entire backup task would fail and get stuck in "running" state in the task center. Now mount copy failures are logged and recorded with status "failed" in the backup metadata, but the backup continues with remaining mounts and completes successfully with partial data. This prevents the task from hanging indefinitely. Fixes #12236 --- agent/app/service/backup_container.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/agent/app/service/backup_container.go b/agent/app/service/backup_container.go index 48214605f9b4..0d5b93f0f971 100644 --- a/agent/app/service/backup_container.go +++ b/agent/app/service/backup_container.go @@ -442,11 +442,19 @@ func stepBackupContainerMounts(backupCtx *containerBackupContext) error { } if sourceInfo.IsDir() { if err := backupCtx.fileOp.CopyDirWithNewName(item.Source, dataDir, "."); err != nil { - return err + mountMeta.Status = "failed" + mountMeta.Message = fmt.Sprintf("copy dir failed: %v", err) + backupCtx.meta.Mounts = append(backupCtx.meta.Mounts, mountMeta) + global.LOG.Errorf("container backup: skip mount %s, copy dir failed: %v", item.Source, err) + continue } } else { if err := backupCtx.fileOp.CopyFile(item.Source, dataDir); err != nil { - return err + mountMeta.Status = "failed" + mountMeta.Message = fmt.Sprintf("copy file failed: %v", err) + backupCtx.meta.Mounts = append(backupCtx.meta.Mounts, mountMeta) + global.LOG.Errorf("container backup: skip mount %s, copy file failed: %v", item.Source, err) + continue } }