]> git.baikalelectronics.ru Git - kernel.git/commitdiff
btrfs: send: allow protocol version 3 with CONFIG_BTRFS_DEBUG
authorBoris Burkov <boris@bur.io>
Tue, 27 Sep 2022 16:30:39 +0000 (09:30 -0700)
committerDavid Sterba <dsterba@suse.com>
Tue, 11 Oct 2022 12:46:55 +0000 (14:46 +0200)
We haven't finalized send stream v3 yet, so gate the send stream version
behind CONFIG_BTRFS_DEBUG as we want some way to test it.

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

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Boris Burkov <boris@bur.io>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/send.c
fs/btrfs/send.h

index 4ef4167072b8920b562b2846d471efaaba2dabb8..178347666235836ae390bc8aa28d4aedde2f0a79 100644 (file)
@@ -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;
index 0a4537775e0c375c1139fea75d8bb22aa7373609..f7585cfa7e52b5ffd4643033b0fd6413def4b744 100644 (file)
 #include <linux/types.h>
 
 #define BTRFS_SEND_STREAM_MAGIC "btrfs-stream"
+/* Conditional support for the upcoming protocol version. */
+#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