fscrypt: clean up and improve dentry revalidation
[linux-block.git] / fs / crypto / hooks.c
index 56debb1fcf5eb49e48a6fa22b618c41158a5c1ca..a9492f75bbe13ffee7c14f69c4d8120ad049116a 100644 (file)
@@ -101,9 +101,9 @@ int __fscrypt_prepare_lookup(struct inode *dir, struct dentry *dentry)
        if (err)
                return err;
 
-       if (fscrypt_has_encryption_key(dir)) {
+       if (!fscrypt_has_encryption_key(dir)) {
                spin_lock(&dentry->d_lock);
-               dentry->d_flags |= DCACHE_ENCRYPTED_WITH_KEY;
+               dentry->d_flags |= DCACHE_ENCRYPTED_NAME;
                spin_unlock(&dentry->d_lock);
        }