lookup_one_p...ive_unlocked(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… lookup_one_p...ive_unlocked β€” a Kernel API Manual moment

okay bestie, welcome to the Kernel API Manual, where today's main character is lookup_one_p...ive_unlocked(9) πŸŽ€ (yes the header truncates it, we don't gatekeep, the full name is lookup_one_positive_unlocked). this one's a little lookup helper and it's honestly kind of iconic for knowing what it wants. let's get into it ✨

🌸 NAME 🌸

lookup_one_positive_unlocked β€” lookup single pathname component. one component. just one. it's giving "i do one thing and i do it well" πŸ’…

πŸ¦‹ SYNOPSIS πŸ¦‹

struct dentry * lookup_one_positive_unlocked (struct mnt_idmap *idmap ,
struct qstr *name , struct dentry *base );

✨ ARGUMENTS ✨

  • idmap β€” the idmap of the mount that the lookup is performed from 🫢
  • name β€” the qstr holding the pathname component you want looked up
  • base β€” the base directory to lookup from, your starting point, your home base πŸ’–

πŸ’œ DESCRIPTION πŸ’œ

okay so here's the vibe: this helper will yield ERR_PTR(-ENOENT) on negatives. like, if it's a no, it's a whole error pointer no, not a weird maybe. and the helper returns either a known positive or ERR_PTR. no gray area, no "it's complicated" situationship. that's literally what most of the users want 😌

⚠️ now for the careful part, bestie β€” a pinned negative with an unlocked parent can become positive at any time, so callers of lookup_one_unlocked need to be very careful. meanwhile pinned positives have >d_inode stable, so this one avoids such problems. it's giving stable queen energy πŸ‘‘

this can be used for in-kernel filesystem clients such as file servers. lowkey its whole purpose πŸ“

and the helper should be called without i_rwsem held. no cap. don't hold it. πŸ™ˆ

πŸ”₯ RETURN πŸ”₯

a positive dentry, or:

  • ERR_PTR(-ENOENT) if the name could not be found, or
  • the same errors as lookup_one_unlocked.

periodt. that's the return contract πŸ’€


🌈 SEE ALSO 🌈

the kernel file ./fs/namei.c and honestly the entire friend group β€” here's everybody, no one left out of the group chat πŸ’–


okay that's the whole page, mwah πŸ’‹ this was brought to you by the source ./fs, version date October 2026, and the page lookup_one_p...ive_unlocked(9) β€” stay positive (dentry-wise), stay unlocked (parent-wise), and don't hold i_rwsem πŸ’…πŸ§šπŸ’œ

πŸ“¦ where this page comes from