linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] btrfs: send: SEND_STREAM_VERSION=3 for CONFIG_BTRFS_DEBUG
@ 2022-09-27 16:30 Boris Burkov
  0 siblings, 0 replies; only message in thread
From: Boris Burkov @ 2022-09-27 16:30 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

We haven't finalized send stream v3 yet, so gate the send stream version
behind CONFIG_BTRFS_DEBUG.

The original verity send did not check the proto version, so add that
actual protection as well.

Signed-off-by: Boris Burkov <boris@bur.io>
---
v2:
- gate protocol version; not command/attr definitions
- actually prevent sending verity data when version < 3

 fs/btrfs/send.c | 2 +-
 fs/btrfs/send.h | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 4ef4167072b8..178347666235 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -6469,7 +6469,7 @@ static int finish_inode_if_needed(struct send_ctx *sctx, int at_end)
 		if (ret < 0)
 			goto out;
 	}
-	if (sctx->cur_inode_needs_verity) {
+	if (sctx->proto >= 3 && sctx->cur_inode_needs_verity) {
 		ret = process_verity(sctx);
 		if (ret < 0)
 			goto out;
diff --git a/fs/btrfs/send.h b/fs/btrfs/send.h
index 0a4537775e0c..d6c5b87d6705 100644
--- a/fs/btrfs/send.h
+++ b/fs/btrfs/send.h
@@ -10,7 +10,11 @@
 #include <linux/types.h>
 
 #define BTRFS_SEND_STREAM_MAGIC "btrfs-stream"
+#ifdef CONFIG_BTRFS_DEBUG
+#define BTRFS_SEND_STREAM_VERSION 3
+#else
 #define BTRFS_SEND_STREAM_VERSION 2
+#endif
 
 /*
  * In send stream v1, no command is larger than 64K. In send stream v2, no limit
-- 
2.37.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-27 16:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-27 16:30 [PATCH v2] btrfs: send: SEND_STREAM_VERSION=3 for CONFIG_BTRFS_DEBUG Boris Burkov

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).