diff mbox series

[v5,52/52] btrfs: disable send if we have encryption enabled

Message ID 62ce86b38e2575c542eed7fbe8d986e68496b1d7.1706116485.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs: add fscrypt support | expand

Commit Message

Josef Bacik Jan. 24, 2024, 5:19 p.m. UTC
send needs to track the dir item values to see if files were renamed
when doing an incremental send.  There is code to decrypt the names, but
this breaks the code that checks to see if something was overwritten.
Until this gap is closed we need to disable send on encrypted file
systems.  Fixing this is straightforward, but a medium sized project.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/send.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Boris Burkov Jan. 24, 2024, 7:28 p.m. UTC | #1
On Wed, Jan 24, 2024 at 12:19:14PM -0500, Josef Bacik wrote:
> send needs to track the dir item values to see if files were renamed
> when doing an incremental send.  There is code to decrypt the names, but
> this breaks the code that checks to see if something was overwritten.
> Until this gap is closed we need to disable send on encrypted file
> systems.  Fixing this is straightforward, but a medium sized project.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Boris Burkov <boris@bur.io>
> ---
>  fs/btrfs/send.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
> index d26ca7b64087..eba45477b10a 100644
> --- a/fs/btrfs/send.c
> +++ b/fs/btrfs/send.c
> @@ -8183,6 +8183,12 @@ long btrfs_ioctl_send(struct inode *inode, struct btrfs_ioctl_send_args *arg)
>  	if (!capable(CAP_SYS_ADMIN))
>  		return -EPERM;
>  
> +	if (btrfs_fs_incompat(fs_info, ENCRYPT)) {
> +		btrfs_err(fs_info,
> +		  "send with encryption enabled isn't currently suported");
s/suported/supported/
> +		return -EINVAL;
> +	}
> +
>  	/*
>  	 * The subvolume must remain read-only during send, protect against
>  	 * making it RW. This also protects against deletion.
> -- 
> 2.43.0
>
diff mbox series

Patch

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index d26ca7b64087..eba45477b10a 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -8183,6 +8183,12 @@  long btrfs_ioctl_send(struct inode *inode, struct btrfs_ioctl_send_args *arg)
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
 
+	if (btrfs_fs_incompat(fs_info, ENCRYPT)) {
+		btrfs_err(fs_info,
+		  "send with encryption enabled isn't currently suported");
+		return -EINVAL;
+	}
+
 	/*
 	 * The subvolume must remain read-only during send, protect against
 	 * making it RW. This also protects against deletion.