linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] btrfs-progs: receive: workaround full file clone quirk
@ 2024-09-27  5:53 Qu Wenruo
  2024-09-27  5:53 ` [PATCH 1/2] btrfs-progs: receive: workaround unaligned full file clone Qu Wenruo
  2024-09-27  5:53 ` [PATCH 2/2] btrfs-progs: misc-tests: new test case check the handling of " Qu Wenruo
  0 siblings, 2 replies; 4+ messages in thread
From: Qu Wenruo @ 2024-09-27  5:53 UTC (permalink / raw)
  To: linux-btrfs

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-09-27  8:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-27  5:53 [PATCH 0/2] btrfs-progs: receive: workaround full file clone quirk Qu Wenruo
2024-09-27  5:53 ` [PATCH 1/2] btrfs-progs: receive: workaround unaligned full file clone Qu Wenruo
2024-09-27  8:14   ` Filipe Manana
2024-09-27  5:53 ` [PATCH 2/2] btrfs-progs: misc-tests: new test case check the handling of " Qu Wenruo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).