fscrypt_is_nokey_name(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… fscrypt_is_nokey_name(9) β€” like, the Kernel API Manual page, bestie

okay so this one's from the Kernel API Manual and it's literally called fscrypt_is_nokey_name(9) β€” yes the (9) is part of the name, that's just how kernel pages roll, periodt. it's a tiny little helper that answers one very specific question and we're gonna get into it πŸŽ€


✨ NAME ✨

fscrypt_is_nokey_name β€” test whether a dentry is a no-key name πŸ‘€


🌸 SYNOPSIS 🌸

bool fscrypt_is_nokey_name (const struct dentry *dentry );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • dentry β€” the dentry you want to check, bestie. that's the vibe check target right there πŸ’…

πŸ’– DESCRIPTION πŸ’–

so this function returns true if the dentry is a no-key dentry. and what even is a no-key dentry, you ask? πŸ₯Ί it's a dentry that was created in an encrypted directory that hasn't had its encryption key added yet. and like β€” plot twist β€” such dentries may be either positive or negative. both. it's giving versatile ✨

now here's the important part, so listen up 🫢 when a filesystem is asked to create a new filename in an encrypted directory and the new filename's dentry is a no-key dentry, it must fail the operation with ENOKEY. must. no negotiation. this includes ->create, ->mkdir, ->mknod, ->symlink, ->rename, and ->link. πŸ‘‘ (though, okay, small note: ->rename and ->link are already handled by fscrypt_prepare_rename and fscrypt_prepare_link, so like, they're covered already, no cap.)

and why is this necessary? i'm so glad you asked 😭 because creating a filename requires the directory's encryption key β€” but just checking for the key on the directory inode during the final filesystem operation doesn't guarantee that the key was available during the preceding dentry lookup. and the key must have already been available during the dentry lookup in order for it to have been checked whether the filename already exists in the directory and for the new file's dentry not to be invalidated due to it incorrectly having the no-key flag. it's a whole chain of trust thing and it fr fr matters πŸ”₯


⭐ RETURN ⭐

true if the dentry is a no-key name βœ…


🌈 SEE ALSO 🌈


πŸ’€ friendly reminder: if you skip the ENOKEY check you're gonna have a bad time. the kernel does not do "oopsie" energy.

and that's the whole page, bestie πŸŽ€ shipped straight out of ./include/linux in the October 2026 drop β€” go forth and check your dentries, mwah πŸ’œπŸ§š

πŸ“¦ where this page comes from