* [PATCH] btrfs: emit BTRFS_SEND_C_FILEATTR during full mode
@ 2026-06-16 18:37 Mateusz Poliwczak
2026-06-17 3:15 ` Qu Wenruo
0 siblings, 1 reply; 4+ messages in thread
From: Mateusz Poliwczak @ 2026-06-16 18:37 UTC (permalink / raw)
To: clm, dsterba; +Cc: linux-btrfs, linux-kernel, Mateusz Poliwczak
Currently BTRFS_SEND_C_FILEATTR is only emmited during incremental
mode when fileattr change between snapshots. This change makes sure
we also emit BTRFS_SEND_C_FILEATTR when sending the full snapshot.
---
fs/btrfs/send.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 3ae480c7474b..effbe7ac1a81 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -6575,8 +6575,10 @@ static int finish_inode_if_needed(struct send_ctx *sctx, bool at_end)
if (!sctx->parent_root || sctx->cur_inode_new) {
need_chown = true;
- if (!S_ISLNK(sctx->cur_inode_mode))
+ if (!S_ISLNK(sctx->cur_inode_mode)) {
need_chmod = true;
+ need_fileattr = true;
+ }
if (sctx->cur_inode_next_write_offset == sctx->cur_inode_size)
need_truncate = false;
} else {
--
2.54.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] btrfs: emit BTRFS_SEND_C_FILEATTR during full mode
2026-06-16 18:37 [PATCH] btrfs: emit BTRFS_SEND_C_FILEATTR during full mode Mateusz Poliwczak
@ 2026-06-17 3:15 ` Qu Wenruo
2026-06-17 6:56 ` [PATCH v2] btrfs: emit BTRFS_SEND_C_FILEATTR during full send Mateusz Poliwczak
0 siblings, 1 reply; 4+ messages in thread
From: Qu Wenruo @ 2026-06-17 3:15 UTC (permalink / raw)
To: Mateusz Poliwczak, clm, dsterba; +Cc: linux-btrfs, linux-kernel
在 2026/6/17 04:07, Mateusz Poliwczak 写道:
> Currently BTRFS_SEND_C_FILEATTR is only emmited during incremental
> mode when fileattr change between snapshots. This change makes sure
> we also emit BTRFS_SEND_C_FILEATTR when sending the full snapshot.
Please explain why.
And there is no signed-off-by required by upstream.
> ---
> fs/btrfs/send.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
> index 3ae480c7474b..effbe7ac1a81 100644
> --- a/fs/btrfs/send.c
> +++ b/fs/btrfs/send.c
> @@ -6575,8 +6575,10 @@ static int finish_inode_if_needed(struct send_ctx *sctx, bool at_end)
>
> if (!sctx->parent_root || sctx->cur_inode_new) {
> need_chown = true;
> - if (!S_ISLNK(sctx->cur_inode_mode))
> + if (!S_ISLNK(sctx->cur_inode_mode)) {
> need_chmod = true;
> + need_fileattr = true;
> + }
> if (sctx->cur_inode_next_write_offset == sctx->cur_inode_size)
> need_truncate = false;
> } else {
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] btrfs: emit BTRFS_SEND_C_FILEATTR during full send
2026-06-17 3:15 ` Qu Wenruo
@ 2026-06-17 6:56 ` Mateusz Poliwczak
2026-06-17 7:56 ` Qu Wenruo
0 siblings, 1 reply; 4+ messages in thread
From: Mateusz Poliwczak @ 2026-06-17 6:56 UTC (permalink / raw)
To: clm, dsterba; +Cc: linux-btrfs, linux-kernel, Mateusz Poliwczak
Currently BTRFS_SEND_C_FILEATTR is only emitted during incremental
send when fileattr change between snapshots. This change makes sure
we also emit BTRFS_SEND_C_FILEATTR when sending the full snapshot.
Without this there is no way to gain access to the fileattr of a file
e.g. the FS_NOCOW_FL flag without doing a separate FS_IOC_GETFLAGS
syscall, which might not be even possible if the stream is send over
network or such.
Signed-off-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
---
fs/btrfs/send.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 3ae480c7474b..effbe7ac1a81 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -6575,8 +6575,10 @@ static int finish_inode_if_needed(struct send_ctx *sctx, bool at_end)
if (!sctx->parent_root || sctx->cur_inode_new) {
need_chown = true;
- if (!S_ISLNK(sctx->cur_inode_mode))
+ if (!S_ISLNK(sctx->cur_inode_mode)) {
need_chmod = true;
+ need_fileattr = true;
+ }
if (sctx->cur_inode_next_write_offset == sctx->cur_inode_size)
need_truncate = false;
} else {
--
2.54.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] btrfs: emit BTRFS_SEND_C_FILEATTR during full send
2026-06-17 6:56 ` [PATCH v2] btrfs: emit BTRFS_SEND_C_FILEATTR during full send Mateusz Poliwczak
@ 2026-06-17 7:56 ` Qu Wenruo
0 siblings, 0 replies; 4+ messages in thread
From: Qu Wenruo @ 2026-06-17 7:56 UTC (permalink / raw)
To: Mateusz Poliwczak, clm, dsterba; +Cc: linux-btrfs, linux-kernel
在 2026/6/17 16:26, Mateusz Poliwczak 写道:
> Currently BTRFS_SEND_C_FILEATTR is only emitted during incremental
> send when fileattr change between snapshots. This change makes sure
> we also emit BTRFS_SEND_C_FILEATTR when sending the full snapshot.
>
> Without this there is no way to gain access to the fileattr of a file
> e.g. the FS_NOCOW_FL flag without doing a separate FS_IOC_GETFLAGS
> syscall, which might not be even possible if the stream is send over
> network or such.
Unfortunately, btrfs receive will just ignore those fileattrs.
It's a known limit:
https://github.com/kdave/btrfs-progs/issues/1057#issuecomment-3492918443
The reason is that different file attrs will require completely
different handling.
From NODATACOW/NODATASUM which can only be set for empty file, to
immutable flags handling.
So this patch will not do any difference, and the whole situation is a
very deep rabbit hole.
If you want to address this problem, please check this issue first:
https://github.com/kdave/btrfs-progs/issues/526
>
> Signed-off-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
> ---
> fs/btrfs/send.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
> index 3ae480c7474b..effbe7ac1a81 100644
> --- a/fs/btrfs/send.c
> +++ b/fs/btrfs/send.c
> @@ -6575,8 +6575,10 @@ static int finish_inode_if_needed(struct send_ctx *sctx, bool at_end)
>
> if (!sctx->parent_root || sctx->cur_inode_new) {
> need_chown = true;
> - if (!S_ISLNK(sctx->cur_inode_mode))
> + if (!S_ISLNK(sctx->cur_inode_mode)) {
> need_chmod = true;
> + need_fileattr = true;
> + }
> if (sctx->cur_inode_next_write_offset == sctx->cur_inode_size)
> need_truncate = false;
> } else {
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-06-17 7:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-16 18:37 [PATCH] btrfs: emit BTRFS_SEND_C_FILEATTR during full mode Mateusz Poliwczak
2026-06-17 3:15 ` Qu Wenruo
2026-06-17 6:56 ` [PATCH v2] btrfs: emit BTRFS_SEND_C_FILEATTR during full send Mateusz Poliwczak
2026-06-17 7:56 ` Qu Wenruo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox