mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: Mateusz Poliwczak <mpoliwczak34@gmail.com>, clm@fb.com, dsterba@suse.com
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] btrfs: emit BTRFS_SEND_C_FILEATTR during full send
Date: Wed, 17 Jun 2026 17:26:14 +0930	[thread overview]
Message-ID: <6260dd58-5b46-47f2-8c4c-382bc470b5aa@suse.com> (raw)
In-Reply-To: <20260617070112.1407453-1-mpoliwczak34@gmail.com>



在 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 {


      reply	other threads:[~2026-06-17  7:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6260dd58-5b46-47f2-8c4c-382bc470b5aa@suse.com \
    --to=wqu@suse.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpoliwczak34@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®