Bug 189671 - btrfs send/receive does not retain file attributes
Summary: btrfs send/receive does not retain file attributes
Status: RESOLVED CODE_FIX
Alias: None
Product: File System
Classification: Unclassified
Component: btrfs (show other bugs)
Hardware: All Linux
: P1 enhancement
Assignee: Josef Bacik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-04 17:02 UTC by ataraxia937
Modified: 2022-10-14 15:26 UTC (History)
3 users (show)

See Also:
Kernel Version: 4.8.10-300.fc25.x86_64
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description ataraxia937 2016-12-04 17:02:50 UTC
When using btrfs send and receive to transfer a subvolume, file attributes (set with chattr) are not copied. I tested this with the 'C' attribute on a directory, which was present in the original subvol, and in the RO snapshot created for use with send, but not in the snapshot created by receive.
Comment 1 David Sterba 2016-12-05 14:49:51 UTC
This is a known problem and will be addressed in v2 of the send/receive protocol update.

https://btrfs.wiki.kernel.org/index.php/Design_notes_on_Send/Receive#Send_stream_v2_draft
Comment 2 David Sterba 2022-10-06 17:38:21 UTC
Partially implemented in send v2.
Comment 3 Tomasz Pala 2022-10-12 10:23:34 UTC
Could you please elaborate the "partially" part a bit? So that we could know what to expect (to be still missing).
Comment 4 David Sterba 2022-10-12 10:58:11 UTC
The protocol v2 now has a command to send the inode attributes/flags (compound name for the chattr/lsattr bits and also for the newish XFLAGS) and the command is also generated when v2 is used.

The receiving side does not apply the flags yet - that's the missing part. In some cases it's not yet possible (lack of interface, like turning on/off the NODATASUM bit), not directly applicable (setting NOCOW on a nonzero file) or tricky (with IMMUTABLE and APPEND bits no changes can be done to the file so they'd have to be unset temporarily).

Now tracked in https://github.com/kdave/btrfs-progs/issues/526.
Comment 5 Tomasz Pala 2022-10-14 15:26:32 UTC
Thank you!

Note You need to log in before you can comment on or make changes to this bug.