finish_open(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay bestie, welcome to finish_open(9) from the Kernel API Manual πŸ’– this page is lowkey all about finishing the open, and it's giving very specific energy. let's get into it ✨

πŸ’– NAME πŸ’–

finish_open β€” finish opening a file. that's the whole main character job, no cap. πŸŽ€

πŸ¦‹ SYNOPSIS πŸ¦‹

int finish_open (struct file *file , struct dentry *dentry , int
       (*open)(struct inode *, struct file *) );

✨ ARGUMENTS ✨

  • file β€” file pointer. yes bestie, the file pointer itself. 🫢
  • dentry β€” pointer to dentry. literally a pointer to the dentry. πŸ¦‹
  • open β€” open callback. the callback that handles the open. πŸ’…

πŸ’… DESCRIPTION πŸ’…

This can be used to finish opening a file passed to i_op->atomic_open. so if that's the situation you're in, this is the finish line, periodt. πŸ”₯

If the open callback is set to NULL, then the standard f_op->open filesystem callback is substituted. iconic substitution behavior, honestly. ✨

NB: the dentry reference is _not_ consumed. If, for example, the dentry is the return value of d_splice_alias, then the caller needs to perform dput on it after finish_open. 🫢 this is the important warning bestie, do not skip it 😭

Returns zero on success or -errno if the open failed. that's the return contract, and it ate. πŸ’œ

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./fs/open.c β€” and the related pages are finish_no_open(9), vfs_open(9), kernel_file_open(9), file_open_name(9), and filp_open(9). go read those too, bestie, iykyk 🌈


xoxo, your kernel bestie πŸ§šπŸ’œ β€” source/version: ./fs, date: October 2026 πŸŽ€

πŸ“¦ where this page comes from