Skip to content

cptofs cleanups, fixes and tests - #647

Draft
ddiss wants to merge 9 commits into
lkl:masterfrom
ddiss:cptofs_tests
Draft

ddiss wants to merge 9 commits into
lkl:masterfrom
ddiss:cptofs_tests

Conversation

@ddiss

@ddiss ddiss commented Sep 30, 2026

Copy link
Copy Markdown

Draft for now, until I better understand the LKL virtio-blk I/O errors when running cptofs.sh -t xfs

Close src fd on dst open failure. Close dst fd on chown failure.

Signed-off-by: David Disseldorp <ddiss@suse.de>
copy_file() doesn't check close() return values. Perform an explicit
fsync() of the copy destination to catch any writeback errors.

Signed-off-by: David Disseldorp <ddiss@suse.de>
selinux attrs provided by -s are only handled when the copy destination
is LKL based (cptofs). Indicate this in the usage message and return
an error if cpfromfs is provided -s instead of ignoring it.

It may make sense to add corresponding host fsetxattr() calls, but the
security namespace is privileged, which will likely cause issues.

Signed-off-by: David Disseldorp <ddiss@suse.de>
cptofs behaves differently depending on whether argv[0] includes cptofs
or not, i.e. when run as cpfromfs.
install (from coreutils) resolves symlinks during binary installation,
so add an explicit ln call to the install rule instead of adding
cpfromfs to progs-y and reusing the existing build rule.

Signed-off-by: David Disseldorp <ddiss@suse.de>
If the user explicitly requests an copy destination selinux attribute
via -s, then we should fail if the fsetattr returns an error.

Signed-off-by: David Disseldorp <ddiss@suse.de>
On short write, copy_file() currently attempts to write any remainder
from a source buffer address *after* the full read length.
I've not actually triggered this code-path, but it's a theoretical
buffer overrun. Fix it by incrementing the buffer address by the amount
written instead of the read amount.

Link: lkl#646
Signed-off-by: David Disseldorp <ddiss@suse.de>
With cptofs the destination is LKL, so lkl_strerror(ret) should be used
instead of strerror(errno). Vice-versa for cpfromfs.

Signed-off-by: David Disseldorp <ddiss@suse.de>
mkdir_dst() already squashes EEXIST errors, so chown will continue to be
triggered in that case.

Signed-off-by: David Disseldorp <ddiss@suse.de>
The new cptofs.sh wrapper attempts basic file and directory tree copies
between lkl and host via cptofs and cpfromfs.

Signed-off-by: David Disseldorp <ddiss@suse.de>
@github-actions

Copy link
Copy Markdown

Test Results

110 files  +  4  110 suites  +4   9m 49s ⏱️ -41s
184 tests  -  22  165 ✅  -  30  11 💤 ±0  0 ❌ ±0   8 🔥 + 8 
662 runs   - 128  592 ✅  - 142  56 💤 ±0  0 ❌ ±0  14 🔥 +14 

For more details on these errors, see this check.

Results for commit 206bdc7. ± Comparison against base commit d0f76a7.

This pull request removes 30 and adds 8 tests. Note that renamed tests count towards both.
disk btrfs ‑ chdir_mnt_point
disk btrfs ‑ closedir
disk btrfs ‑ disk_add
disk btrfs ‑ disk_remove
disk btrfs ‑ mount_dev
disk btrfs ‑ opendir
disk btrfs ‑ readdir
disk btrfs ‑ start_kernel
disk btrfs ‑ stop_kernel
disk btrfs ‑ umount_dev
…
disk btrfs ‑ cptofs_file
disk btrfs ‑ cptofs_tree
disk ext4 ‑ cptofs_file
disk ext4 ‑ cptofs_tree
disk vfat ‑ cptofs_file
disk vfat ‑ cptofs_tree
disk xfs ‑ cptofs_file
disk xfs ‑ cptofs_tree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant