All of lore.kernel.org
 help / color / mirror / Atom feed
From: fdmanana@kernel.org
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 1/2] btrfs-progs: receive: fix parsing of attributes field from the fileattr command
Date: Thu,  3 Nov 2022 16:53:26 +0000	[thread overview]
Message-ID: <d6c43dfa29a3ab6015e82a030b8f869470d3fd76.1667494221.git.fdmanana@suse.com> (raw)
In-Reply-To: <cover.1667494221.git.fdmanana@suse.com>

From: Filipe Manana <fdmanana@suse.com>

We're trying to get a U32 for the attributes, but the kernel sends a U64
(which is correct as we store attributes in a u64 flags field of the
inode). This makes anyone trying to receive a v2 send stream to fail with:

    ERROR: invalid size for attribute, expected = 4, got = 8

We actually recently got such a report of someone using send stream v2 and
getting such failure. See the Link tag below.

Link: https://lore.kernel.org/linux-btrfs/6cb11fa5-c60d-e65b-0295-301a694e66ad@inbox.ru/
Fixes: 7a6fb356dc65 ("btrfs-progs: receive: process setflags ioctl commands")
Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 common/send-stream.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/send-stream.c b/common/send-stream.c
index 72a25729..e9f565e6 100644
--- a/common/send-stream.c
+++ b/common/send-stream.c
@@ -570,7 +570,7 @@ static int read_and_process_cmd(struct btrfs_send_stream *sctx)
 		break;
 	case BTRFS_SEND_C_FILEATTR:
 		TLV_GET_STRING(sctx, BTRFS_SEND_A_PATH, &path);
-		TLV_GET_U32(sctx, BTRFS_SEND_A_FILEATTR, &fileattr);
+		TLV_GET_U64(sctx, BTRFS_SEND_A_FILEATTR, &fileattr);
 		ret = sctx->ops->fileattr(path, fileattr, sctx->user);
 		break;
 	}
-- 
2.35.1


  reply	other threads:[~2022-11-03 16:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 16:53 [PATCH 0/2] btrfs-progs: receive: address setattr failures fdmanana
2022-11-03 16:53 ` fdmanana [this message]
2022-11-03 16:53 ` [PATCH 2/2] btrfs-progs: receive: work around failure of fileattr commands fdmanana
2022-11-11 15:36 ` [PATCH 0/2] btrfs-progs: receive: address setattr failures David Sterba

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=d6c43dfa29a3ab6015e82a030b8f869470d3fd76.1667494221.git.fdmanana@suse.com \
    --to=fdmanana@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.