diff --git a/src/image/layer/create.zig b/src/image/layer/create.zig index c41656b5..8a9537bc 100644 --- a/src/image/layer/create.zig +++ b/src/image/layer/create.zig @@ -133,7 +133,9 @@ fn writeTarFromDir( } try file_writer.interface.flush(); - tar_file.sync(std.Options.debug_io) catch {}; + // a failed fsync means the layer tar may not be durable; surface it + // rather than silently hashing a possibly-unflushed file. + tar_file.sync(std.Options.debug_io) catch |err| log.warn("layer tar fsync failed: {}", .{err}); var hash_file = try cwd().openFile(std.Options.debug_io, tar_path, .{}); defer hash_file.close(std.Options.debug_io); diff --git a/src/image/registry/blob_transfer.zig b/src/image/registry/blob_transfer.zig index be0cc36f..71866fcd 100644 --- a/src/image/registry/blob_transfer.zig +++ b/src/image/registry/blob_transfer.zig @@ -273,7 +273,9 @@ fn downloadBlobUrlToStore( tmp_file.writeStreamingAll(std.Options.debug_io, chunk_buf[0..bytes_read]) catch return error.NetworkError; } - tmp_file.sync(std.Options.debug_io) catch {}; + // surface a failed fsync — the digest verify below still guards + // correctness, but a silent sync failure hides a durability problem. + tmp_file.sync(std.Options.debug_io) catch |err| log.warn("blob download fsync failed: {}", .{err}); try verifyFileDigest(tmp_path, expected); blob_store.commitTempBlob(tmp_path, expected) catch return error.NetworkError; committed = true; diff --git a/src/image/store/blob_runtime.zig b/src/image/store/blob_runtime.zig index b07ddd0a..0a51f818 100644 --- a/src/image/store/blob_runtime.zig +++ b/src/image/store/blob_runtime.zig @@ -51,7 +51,7 @@ pub fn putBlobFromFile(source_path: []const u8, expected_digest: digest_support. break; }; } - dest_file.sync(std.Options.debug_io) catch {}; + dest_file.sync(std.Options.debug_io) catch |err| log.warn("blob copy fsync failed: {}", .{err}); if (!write_ok) { cwd().deleteFile(std.Options.debug_io, tmp_path) catch {}; @@ -89,7 +89,7 @@ fn writeToStore(data: []const u8, digest: digest_support.Digest) types.BlobError cwd().deleteFile(std.Options.debug_io, tmp_path) catch {}; return types.BlobError.WriteFailed; }; - file.sync(std.Options.debug_io) catch {}; + file.sync(std.Options.debug_io) catch |err| log.warn("blob store fsync failed: {}", .{err}); renameTempToBlob(tmp_path, digest) catch return types.BlobError.WriteFailed; }