diff mbox series

[v14,51/64] ceph: disable copy offload on encrypted inodes

Message ID 20220427191314.222867-52-jlayton@kernel.org (mailing list archive)
State New, archived
Headers show
Series ceph+fscrypt: full support | expand

Commit Message

Jeff Layton April 27, 2022, 7:13 p.m. UTC
If we have an encrypted inode, then the client will need to re-encrypt
the contents of the new object. Disable copy offload to or from
encrypted inodes.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
 fs/ceph/file.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series


diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 1024dc57898d..483d7d016ad6 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -2536,6 +2536,10 @@  static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off,
 		return -EOPNOTSUPP;
+	/* Every encrypted inode gets its own key, so we can't offload them */
+	if (IS_ENCRYPTED(src_inode) || IS_ENCRYPTED(dst_inode))
+		return -EOPNOTSUPP;
 	if (len < src_ci->i_layout.object_size)
 		return -EOPNOTSUPP; /* no remote copy will be done */