From 60a253a2f6e9ff481aa93c0e6bc74a306281057f Mon Sep 17 00:00:00 2001 From: atlas Date: Tue, 14 Jul 2026 19:16:49 +0200 Subject: [PATCH] fix(#1763): address argus review on PR #2430 - regenerate docs/tools/hivectl-cli.md for the new `subvol snapshot send` verb - close the TOCTOU on the no-overwrite guard: File::options().create_new(true) (O_CREAT|O_EXCL) instead of exists()-then-create, so the guarantee is atomic against a concurrent request racing the same dest filename - warn (not silently swallow) if cleaning up a partial export after a failed btrfs send itself fails, so a stuck garbage file masquerading as a completed export is visible in the log --- docs/tools/hivectl-cli.md | 20 ++++++++++++++++++++ hive-priv/src/main.rs | 33 +++++++++++++++++++++++++-------- 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/docs/tools/hivectl-cli.md b/docs/tools/hivectl-cli.md index f2de9575..99825efd 100644 --- a/docs/tools/hivectl-cli.md +++ b/docs/tools/hivectl-cli.md @@ -41,6 +41,7 @@ This document contains the help content for the `hivectl` command-line program. * [`hivectl subvol snapshot`↴](#hivectl-subvol-snapshot) * [`hivectl subvol snapshot create`↴](#hivectl-subvol-snapshot-create) * [`hivectl subvol snapshot delete`↴](#hivectl-subvol-snapshot-delete) +* [`hivectl subvol snapshot send`↴](#hivectl-subvol-snapshot-send) * [`hivectl open`↴](#hivectl-open) * [`hivectl completions`↴](#hivectl-completions) @@ -581,6 +582,7 @@ Read-only snapshots of an agent's state subvolume — the first step of the (in- * `create` — Create a read-only snapshot. Agent must already be a subvolume (`subvol upgrade` first). Prints the snapshot's host path * `delete` — Delete a snapshot created by `subvol snapshot create` +* `send` — Export a snapshot to a local file via `btrfs send` (the local-file half of inter-hive migration transport; the cross-hive `ssh ... btrfs receive` leg isn't wired up yet). Also useful standalone as a point-in-time backup: a full send with no `--parent` produces a self-contained archive of the snapshot @@ -613,6 +615,24 @@ Delete a snapshot created by `subvol snapshot create` +## `hivectl subvol snapshot send` + +Export a snapshot to a local file via `btrfs send` (the local-file half of inter-hive migration transport; the cross-hive `ssh ... btrfs receive` leg isn't wired up yet). Also useful standalone as a point-in-time backup: a full send with no `--parent` produces a self-contained archive of the snapshot + +**Usage:** `hivectl subvol snapshot send [OPTIONS] --dest