Repository navigation
ALI-2600: One message per failed copy or move, and undo a copy that fills its destination - #66
Conversation
…ills its destination
Copying an 11 GB folder to a nearly full /tmp gave one notice per file left
over, in the system's words ("e4_8b_pool_ld.upk: Disk quota exceeded"), four
at a time. Now a job tells each reason once, and a full destination undoes
the job instead of leaving half a folder behind.
- Plainer reasons, by error kind, keeping "file name: reason" for a single
failure: no space or quota ("There isn't enough space in “tmp”, which has
4.2 MB free"), permission (to change the folder written in, or to read the
item), read-only drive, name too long, I/O error, and gone. Other kinds keep
the system's words.
- Failures are gathered during the job and told when it ends. Several with
the same reason become one notice with a count ("12 files: You don't have
permission to read them"), so a screen reader hears one announcement.
- A copy, or a move to another disk, is measured before it starts. When the
destination is on another filesystem and not a network share, the size is
compared with the smaller of statvfs's free space and what's left of the
user's quota (quotactl_fd, Q_GETQUOTA). If it won't fit, nothing starts:
"“Life Is Strange” needs 11 GB, but “tmp” only has 6.3 GB free".
- The first ENOSPC or EDQUOT stops the job. Everything it made is removed:
the cut-short file, each folder it created (with what it put there), and,
inside folders it merged into, each file it added. What a Replace sent to
the Trash comes back. Nothing that was there before is touched. One
message: "Couldn't copy “Life Is Strange”: there isn't enough space in
“tmp”. Nothing was copied".
- A move to another disk copies everything first and removes the originals
only once all of it has arrived. If the destination fills, the copies go
and the originals stay. A file that changed while it was being copied is
kept, with a notice.
- Extracting several archives that fail the same way is told once too.
Tests: unit tests for each reason, for the grouping, and, on 4 MiB tmpfs
disks that scripts/sandbox-run.sh now mounts, for a copy refused before it
starts, one that fills partway, a merge that fills, and a move that fills.
e2e checks for the same three cases on a 4 MiB tmpfs in the app's sandbox.
GANNET_SKIP_SPACE_CHECK (bench builds only) lets a check fill a disk
partway.
Copy speed, home (btrfs) to /tmp (tmpfs), median of alternating runs:
2 GB file 405.1 ms on main, 401.9 ms here; 20,000 files 174.9 ms on main,
173.7 ms here.
…y-errors # Conflicts: # scripts/sandbox-run.sh
…n avoids space::is_remote now uses complete::avoided_fs, as the path bar's completion does: network shares, autofs and FUSE other than fuseblk, never /, and any mount inside one of them counts as it.
|
Review round 1. The code-review skill ran, and its findings were checked with a hand review of ops.rs and space.rs. Confirmed fine:
Being fixed:
|
…back, names kept - The check for room counts the blocks the sources have allocated, not their size rounded up, and is skipped when the answer isn't clear: a source's name is already in the destination (a merge or a conflict), or the destination is on btrfs, zfs or bcachefs (compression, shared or deduped blocks), a network share or FUSE. Sources on the destination's device, as through a bind mount, still aren't counted. A plain overflow is still refused, and only the sources from other devices are counted in "These N items need". - Stopping a move across disks, by Cancel or by the dialog, removes the copies it made and deletes no original: "Stopped moving “X”. Nothing was moved", in place of "Stopped: Moving…" (Outcome::stopped). - A collapsed notice keeps the first 5 paths and the count in Event::Error. The job keeps a count per reason and those 5 paths, not every failure. The command line tells each failure with its own path (Engine::tell_each), and an error about no one item has no path. - Removing the sources of a move: only "not found" counts as gone. Another error is reported and the source stays, and isn't recorded as moved. - A rename that fails with no space is handled as a full destination. - Asking for free space for the "not enough space" reason skips shares. - Wording: "It's no longer there" and "couldn't read or write it" after the name, "1 on the same drive was moved", and no-space reasons in two folders with one name are told apart. - Module doc notes two known limits: the paths a big move holds until the end, and a folder the job made going with what others put in it.
|
Round 1 fixes are in a8333a4. All 12 done, none declined.
Throughput, cores 16–31, 11 alternating runs, median:
The 20,000-file difference is inside the run-to-run spread. Unit tests: 979. Clippy: 0 warnings. e2e passes. |
|
Review round 2. The code-review skill ran, and its findings were checked. Data safety holds:
Being fixed:
Also confirmed: hard links are counted per path, which is correct for a copy; conflict-skip is conservative; failure counts are exact past 5; |
…inside a move - Removing the sources of a move: on a share or FUSE mount, where inode numbers can change between looks (mounts::inodes_may_change), a file is known by its size and time alone, so moving a folder off SMB or sshfs doesn't keep every original. - A stopped or full move takes back only what it copied. A merge on one disk that was stopped keeps what it renamed, removes the folders it emptied, and isn't "Nothing was moved". The count of what moved on the same drive is of items renamed, including inside merges, and the folders merged into stay selected. - The check for room asks space::worth_checking before looking for names in the destination, so nothing on a share is looked up. - space::is_remote and worth_checking follow the destination one part at a time against the mount table (complete::resolve), so a link to a share counts as the share and nothing on it is touched. - A move or delete doesn't count what's on a disk mounted inside the folder, which it leaves where it is. - A stop that comes once every copy has arrived and the originals are being removed finishes the move, which isn't reported as stopped.
|
Round 2 fixes are in eacfd00. All 6 done.
Unit tests: 983. Clippy: 0 warnings. e2e passes. |
|
Review round 3. The code-review skill ran over the whole branch, and its findings were checked against eacfd00. No data loss was found.
Being fixed:
|
…rogress while removing - A source on a share whose inode numbers change between looks is now told apart by its size, its modification time and, where the share keeps one, its change time. One changed within 2 s of being copied or of the job starting is kept, as a change that close can leave the times the same. - Which mounts count as such shares is mounts::inodes_renumbered: network filesystems and network FUSE (sshfs, gvfsd-fuse, rclone and the like), not fuseblk, exFAT or other local FUSE, whose inode numbers are stable. It's worked out only once a top-level item is copied, not for renames. - "N on the same drive were moved" counts top-level items only. - Removing a move's sources counts in its progress, so the bar doesn't sit at the end meanwhile. - A file counts toward the room it needs as the smaller of its allocated blocks and its size rounded up to 4 KiB, so neither a sparse file nor one with reserved space is over-counted.
|
Round 3 fixes are in b51bfa6.
Unit tests: 984. Clippy: 0 warnings. e2e passes. |
|
Review round 4 (by hand, a narrow check of b51bfa6's share comparison). Confirmed fine: ctime reported as 0 and future mtimes fail safe; the window is in the keep direction; the lazy Being fixed:
|
…e its copy
- The reference time for telling whether a moved source changed is taken
right before it's looked at, ahead of the copy, or the job's start if
that's earlier (reference_time).
- On a share, times come from the server's clock, so a file whose time is
at or after 10 s before the reference is taken as changed and kept. That
covers a server up to 10 s behind, and any amount ahead. Beyond 10 s
behind, only the size and change time can tell, as the doc says.
- Local disks with coarse times (vfat, exFAT and msdos at 2 s, ext3 at 1 s)
compare the change time too, where it's kept, and use the same window.
Care::{Strict, Coarse, Loose}, from the mount table the move reads once.
- mounts::inodes_renumbered also takes in fuse.glusterfs, fuse.ceph-fuse,
fuse.davfs, the MTP FUSE kinds, afs, lustre and vboxsf. Plain fuse stays
out, and so is compared strictly.
|
Round 4 fixes are in ea33bb1.
Unit tests: 986. Clippy: 0 warnings. e2e passes. |
|
Review round 5 (by hand, narrow check of ea33bb1): no P1 or P2. The Strict path for local fine-time disks is unchanged. Coarse only tightens. Loose keeps a superset of what it kept before under a forward-moving clock, and the time arithmetic can't panic. Declined, both very narrow:
|
…s its names in CI lists names in another order than the btrfs scratch disk here, and both failed there. - a_full_merge_takes_away_only_what_it_added answers every clash with Replace for all, however many come up before the disk fills, instead of expecting three questions. - stopping_a_merge_on_one_disk_keeps_what_it_renamed gives each merged folder one thing and stops at a second source, which place_all reaches after the first, so the questions come in one order on any disk.
|
CI passes on 7be03ad. The two merge tests depended on the order a folder lists its names in, which differs on CI's filesystem. They no longer do, and no behaviour changed. Review is clean after five rounds (the last two narrow, on the move-safety logic). The body now describes how moved originals are compared. |
Fixes ALI-2600.
When a copy filled its destination, each file left got its own notice in the system's words, for example "e4_8b_pool_ld.upk: Disk quota exceeded", four at a time, with half the folder left behind. Mike decided to keep the "file name: reason" format, to collapse repeats, and to undo a copy that runs out of room, as Finder does.
Behaviour
quotactl_fd,Q_GETQUOTA), in the newcrates/core/src/space.rs. If it won't fit, nothing starts: "“Life Is Strange” needs 11 GB, but “tmp” only has 8.5 GB free".complete::avoided_fsrule as path suggestions, without touching the share.mounts::inodes_renumbered) compare size, mtime and ctime.GANNET_SKIP_SPACE_CHECKturns the space check off, so an e2e check can fill a disk partway.Throughput
Home btrfs to /tmp tmpfs, median:
Checks
Mike tried a dev build: an 11 GB copy into his /tmp scratch was refused before starting, because his quota is the smaller limit there, and three unreadable files gave one notice.
Unit tests pass, with new ones for:
scripts/sandbox-run.shmounts at/run/gannet-small/*;The six behaviour tests fail against main.
Clippy: 0 warnings.
Sizing counts each file as the smaller of its allocated blocks and its size rounded up to 4 KiB, so sparse and preallocated files are both measured fairly.
e2e: all pass, including
a_copy_too_big_for_the_disk_never_starts,a_copy_that_fills_the_disk_is_undone_even_in_a_mergeanda_move_that_fills_the_other_disk_leaves_the_originals, each of which fails with main's binary.failures_are_visibleis updated for the new wording.main (ALI-2632: Hide the host's drives and network shares from the test sandboxes #62, ALI-2599: Suggest folders while a path is typed, with Tab to complete #64, ALI-2601: Format a removable drive from the sidebar #65) is merged in. The only conflict was
scripts/sandbox-run.sh, where ALI-2632: Hide the host's drives and network shares from the test sandboxes #62's block is kept and the small disks follow it.