From: Jeff Layton Date: Tue, 26 Jan 2021 19:12:24 +0000 (-0500) Subject: ceph: properly set DCACHE_NOKEY_NAME flag in lookup X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3d8252a3d6dc2f9badb29c86305e302371c836d5;p=ceph-client.git ceph: properly set DCACHE_NOKEY_NAME flag in lookup This is required so that we know to invalidate these dentries when the directory is unlocked. Reviewed-by: Xiubo Li Signed-off-by: Jeff Layton --- diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index daa7486fad00..e4a5a3d7dfaf 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -760,6 +760,17 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry, if (dentry->d_name.len > NAME_MAX) return ERR_PTR(-ENAMETOOLONG); + if (IS_ENCRYPTED(dir)) { + err = __fscrypt_prepare_readdir(dir); + if (err) + return ERR_PTR(err); + if (!fscrypt_has_encryption_key(dir)) { + spin_lock(&dentry->d_lock); + dentry->d_flags |= DCACHE_NOKEY_NAME; + spin_unlock(&dentry->d_lock); + } + } + /* can we conclude ENOENT locally? */ if (d_really_is_negative(dentry)) { struct ceph_inode_info *ci = ceph_inode(dir);