space: zfs diffs run side by side, give up after four minutes, and die properly

The timeout killed sudo and left zfs holding the pipe, so the refresh of tank sat on
immich's diff indefinitely. The process group is killed now, and a slow dataset is walked
by mtime instead.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Mitchell-Johnson
2026-09-23 01:13:05 -07:00
co-authored by Claude Fable 5.1
parent 53d1da08a5
commit 314a021a3e
2 changed files with 48 additions and 8 deletions
+4 -1
View File
@@ -356,7 +356,10 @@ something long in one, switch away and back, refresh — it's all still there.
snapshots, the scan records the newest snapshot of each dataset at start (`bases`), and the
next one runs `zfs diff -H -F <base>` per dataset: only the directories it names are
read, their ancestors kept but looked into, everything else kept wholesale without a
stat. Elsewhere (ext4, or a dataset with no snapshot) a directory whose mtime — to the
stat. The diffs run side by side and one is given four minutes (its process group is
killed, sudo and zfs both), after which that dataset is walked by mtime instead — on
`tank`, `immich` changes constantly and its diff ran past twenty minutes the first time,
longer than walking it. Elsewhere (ext4, or a dataset with no snapshot) a directory whose mtime — to the
nanosecond — is unchanged keeps its list and only its kept files are stat'ed again, since
a file can grow without its directory noticing. A **cancelled** scan keeps what it walked,
marks the folders it never got to (`partial`, "not yet read" in the tree) and **Resume**