Skip to content

btrfs-progs: receive: workaround full file clone quirk

Qu Wenruo linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs-progs: receive: workaround unaligned full file clonecmds/receive.c+47 -01 reply
2/2btrfs-progs: misc-tests: new test case check the handling of full file clonetests/misc-tests/066-receive-full-file-clone/ro_snap1.stream.zst tests/misc-tests/066-receive-full-file-clone/ro_subv1.stream.zst tests/misc-tests/066-receive-full-file-clone/test.sh+24 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] btrfs-progs: receive: workaround full file clone quirk

Since kernel commit 46a6e10a1ab1 ("btrfs: send: allow cloning non-aligned extent if it ends at i_size"), we can have clone commands to clone a full file.

However such full file clone can have an unaligned length, and such clone is only allowed if the destination file is no larger than the clone range.

But we can create a case where such clone called on a destination file which has a larger size.
This can lead to kernel reject such clone, and fail the receive.

This patchset will handle such quirk by truncate the file size to 0 if we detect this is a full file clone.

Also add a new test case to verify the behaivor.

Qu Wenruo (2):
btrfs-progs: receive: workaround unaligned full file clone
btrfs-progs: misc-tests: new test case check the handling of full file
clone

 cmds/receive.c                                |  47 ++++++++++++++++++
 .../ro_snap1.stream.zst                       | Bin 0 -> 293 bytes
 .../ro_subv1.stream.zst                       | Bin 0 -> 413 bytes
 .../066-receive-full-file-clone/test.sh       |  24 +++++++++
 4 files changed, 71 insertions(+)
 create mode 100644 tests/misc-tests/066-receive-full-file-clone/ro_snap1.stream.zst
 create mode 100644 tests/misc-tests/066-receive-full-file-clone/ro_subv1.stream.zst
 create mode 100755 tests/misc-tests/066-receive-full-file-clone/test.sh

--
2.46.1