From patchwork Wed Apr 27 19:13:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 566781 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBA48C433F5 for ; Wed, 27 Apr 2022 19:19:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233952AbiD0TWS (ORCPT ); Wed, 27 Apr 2022 15:22:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233826AbiD0TTX (ORCPT ); Wed, 27 Apr 2022 15:19:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C080562C8 for ; Wed, 27 Apr 2022 12:13:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 27AF8B8291D for ; Wed, 27 Apr 2022 19:13:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EE22C385AA; Wed, 27 Apr 2022 19:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651086832; bh=qhce0OEg+JNVepHokYTlytSJKJrB4yhKGHHYs3Z054Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hqvh/Up3ruXLX9tNu8fxLsmb+CR4iNIkeETD9Zpro1iK1Ni0r1TpsStgkN3tScSy6 iStrErmYYX649G7B9QzC+6KsvyUJY0vZt55aWy8Unuvh9niCSmidCjOiEPhXi0+2Nu Y6Q6uapt1/QZKlKCGk0cmGL3iSCV4P03CSYIkXhTaddd6ozVwM5uYBb2zsn6Ct/Fhq DeLsDEIkfq4CNqK0iHEkkumN0ySGWzkCXtW75ZU5Pv4g3Muw1N7xzSYGefXV8NcdTl JQibwCT7L6I7EjDM/5Ea7QyGUFG0CGZ2us2lfn9God6jVKvvFiwZgHTf62i7TKskBT S5GNfh6WMMrhg== From: Jeff Layton To: ceph-devel@vger.kernel.org Cc: xiubli@redhat.com, lhenriques@suse.de, idryomov@gmail.com Subject: [PATCH v14 51/64] ceph: disable copy offload on encrypted inodes Date: Wed, 27 Apr 2022 15:13:01 -0400 Message-Id: <20220427191314.222867-52-jlayton@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220427191314.222867-1-jlayton@kernel.org> References: <20220427191314.222867-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org 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 --- fs/ceph/file.c | 4 ++++ 1 file changed, 4 insertions(+) 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 */