From patchwork Fri Jun 25 13:58:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 12345177 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.4 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 47849C2B9F4 for ; Fri, 25 Jun 2021 13:59:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E1DD6197D for ; Fri, 25 Jun 2021 13:59:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231889AbhFYOBf (ORCPT ); Fri, 25 Jun 2021 10:01:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:34356 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231926AbhFYOBK (ORCPT ); Fri, 25 Jun 2021 10:01:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 551CB61988; Fri, 25 Jun 2021 13:58:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624629529; bh=JU4DQ7j7wrJ8iMCOP/TiRnqcZf1DzonMo6IsxnCfnlc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ev87Zpa6DQP8tccz4vkwQ+bYxOvJ+g16fICXFXKUbkV0a0kZO8MvTlsp7aZetDias Otw0woYjGvTz9iNVGqGMCO67r484DL+OVYTYYKVHJst8Gl4jnlIENi1WjR2u068iuU ySS5NxO2a8dx1myBOPyccYzbY0PCsWTPJaQ97JSb3B3pnDJHZ2xLjFUchOMIz8TYgb oqYrIS7fL+VYxnmaeqetPwO9b0SvegtS1TtcOGxU2mGSaBeKiPVcnJqSXHcyy5z54U AOEUjtYCOKd8kslIOa7sI01dpj6G6UA9TPKVISEdJaL3b04w3ZOXPFQEmrlSCuoZdg RW38OUyINiFkQ== From: Jeff Layton To: ceph-devel@vger.kernel.org Cc: lhenriques@suse.de, xiubli@redhat.com, linux-fsdevel@vger.kernel.org, linux-fscrypt@vger.kernel.org, dhowells@redhat.com Subject: [RFC PATCH v7 18/24] ceph: make d_revalidate call fscrypt revalidator for encrypted dentries Date: Fri, 25 Jun 2021 09:58:28 -0400 Message-Id: <20210625135834.12934-19-jlayton@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210625135834.12934-1-jlayton@kernel.org> References: <20210625135834.12934-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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 7d6ad4ea535c..7a795e409007 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -1700,6 +1700,10 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags) struct inode *dir, *inode; struct ceph_mds_client *mdsc; + valid = fscrypt_d_revalidate(dentry, flags); + if (valid <= 0) + return valid; + if (flags & LOOKUP_RCU) { parent = READ_ONCE(dentry->d_parent); dir = d_inode_rcu(parent); @@ -1712,8 +1716,8 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags) inode = d_inode(dentry); } - dout("d_revalidate %p '%pd' inode %p offset 0x%llx\n", dentry, - dentry, inode, ceph_dentry(dentry)->offset); + dout("d_revalidate %p '%pd' inode %p offset 0x%llx nokey %d\n", dentry, + dentry, inode, ceph_dentry(dentry)->offset, !!(dentry->d_flags & DCACHE_NOKEY_NAME)); mdsc = ceph_sb_to_client(dir->i_sb)->mdsc;