]> git.apps.os.sepia.ceph.com Git - ceph-client.git/commitdiff
ceph: properly set DCACHE_NOKEY_NAME flag in lookup
authorJeff Layton <jlayton@kernel.org>
Tue, 26 Jan 2021 19:12:24 +0000 (14:12 -0500)
committerXiubo Li <xiubli@redhat.com>
Thu, 18 Aug 2022 02:59:51 +0000 (10:59 +0800)
This is required so that we know to invalidate these dentries when the
directory is unlocked.

Reviewed-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
fs/ceph/dir.c

index daa7486fad00950c8c649bff2183c12dfa051f61..e4a5a3d7dfaf1951cdb0a283e0556477d30d0f51 100644 (file)
@@ -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);