From patchwork Wed Jan 20 18:28:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 12033297 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAF93C43331 for ; Wed, 20 Jan 2021 18:33:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 91992233FA for ; Wed, 20 Jan 2021 18:33:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404331AbhATSdM (ORCPT ); Wed, 20 Jan 2021 13:33:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:51580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404560AbhATSam (ORCPT ); Wed, 20 Jan 2021 13:30:42 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B36EF233FC; Wed, 20 Jan 2021 18:28:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611167339; bh=ntuOc4aKlT0wMcHSt6IL/piAyoR1etQFX/8sCIThbNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=McA4hoXO6oXe0QENGNSK8o5aXrO5f7bCjz4i0O8xB8wMJl3wHyvkkmMbl+sL5V1F1 gDZ/Unp/Yq37O2j+lfSF+1fVlSWWN1croCNvG9tNSuuH0T+bE1Zu1lBdF/0A99/xln NfZRiRoNyqTlvlvIDjLMtWfR9bHwYTAR34zY3tVIGJoSObcbXVOAk55kz103dr+HTo 3ur2w5/AGkOL8mmD0pADMigxWspyAoSBvUwMLLw6GM+l3o3ZBrF3kC7mITKzQ+qaSv LDVmjdt31SUCgoCrsqmtIvHH1ehJBy8FnE8kEHYZTTiCY9d+lK9Dnc7Sh7qHQKr7FS FbL7zEqNhiM5g== From: Jeff Layton To: ceph-devel@vger.kernel.org Cc: linux-fscrypt@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [RFC PATCH v4 15/17] ceph: make d_revalidate call fscrypt revalidator for encrypted dentries Date: Wed, 20 Jan 2021 13:28:45 -0500 Message-Id: <20210120182847.644850-16-jlayton@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210120182847.644850-1-jlayton@kernel.org> References: <20210120182847.644850-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org If we have a dentry which represents a no-key name, then we need to test whether the parent directory's encryption key has since been added. Do that before we test anything else about the dentry. Signed-off-by: Jeff Layton --- fs/ceph/dir.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 236c381ab6bd..cb7ff91a243a 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -1726,6 +1726,10 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags) dout("d_revalidate %p '%pd' inode %p offset 0x%llx\n", dentry, dentry, inode, ceph_dentry(dentry)->offset); + valid = fscrypt_d_revalidate(dentry, flags); + if (valid <= 0) + return valid; + mdsc = ceph_sb_to_client(dir->i_sb)->mdsc; /* always trust cached snapped dentries, snapdir dentry */