gfs2_create_inode(9)
π NAME π
gfs2_create_inode β bestie, this is the one that literally creates a brand-new inode β¨
It's a kernel API thing (so it lives in the gfs2_create_inode(9) manual, iykyk), and it's giving "main character energy" of the whole create-a-file pipeline πΈ
β¨ SYNOPSIS β¨
int gfs2_create_inode (struct inode *dir , struct dentry *dentry ,
struct file *file , umode_t mode , dev_t dev , const char *symname ,
unsigned int size , int excl );
π ARGUMENTS π
Okay so here's the whole cast of characters, no skips, we're not doing that π
dirβ the parent directory π«Ά the one that's gonna host the new inode, like the group chat it gets added todentryβ the new dentry π¦ freshly minted, never been seen beforefileβ if it's non-NULL, this is the file that's being opened π (if it'sNULL, it just isn't, periodt)modeβ the permissions on the new inode πdevβ for device nodes, this is the device number π (yes, only for device nodes, don't come for me)symnameβ for symlinks, this is the link destination πsizeβ the initial size of the inode β and heads up: it's ignored for directories, so don't even try itexclβ force fail if the inode exists π« like a bouncer at the club, absolutely no duplicates allowed
π DESCRIPTION π
Okay, so the source itself literally has a FIXME in here, and honestly? Iconic of it to be that honest π Here's what it says:
Change to allocate the disk blocks and write them out in the same transaction. That way, we can no longer end up in a situation in which an inode is allocated, the node crashes, and the block looks like a valid inode. (With atomic creates in place, we will also no longer need to zero the link count and dirty the inode here on failure.)
So basically the plan is: allocate the disk blocks and write them out in the same transaction β because right now the lowkey cursed scenario is that an inode gets allocated, the node crashes, and then the block is just out here looking like a valid inode π§ and once atomic creates are in place, we also won't need to zero the link count and dirty the inode here on failure anymore either. Slay, future improvement π₯
π RETURN π
0 on success, or an error code π (that's it, that's the whole vibe check)
π SEE ALSO π
Kernel file ./fs/gfs2/inode.c, plus the whole friend group π«Ά:
gfs2_set_iop(9)gfs2_inode_lookup(9)gfs2_lookup_by_inum(9)gfs2_lookup_meta(9)gfs2_lookupi(9)create_ok(9)gfs2_init_xattr(9)init_dinode(9)gfs2_trans_da_blks(9)gfs2_create(9)__gfs2_lookup(9)gfs2_link(9)gfs2_unlink_inode(9)gfs2_unlink(9)gfs2_symlink(9)gfs2_mkdir(9)gfs2_mknod(9)gfs2_atomic_open(9)update_moved_ino(9)gfs2_rename(9)gfs2_exchange(9)gfs2_get_link(9)gfs2_permission(9)gfs2_setattr(9)gfs2_getattr(9)
And that's the page, bestie!! π This masterpiece comes to you from ./fs/gfs2, dated October 2026, and it's filed under gfs2_create_inode(9) β mwah, go create some inodes responsibly πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms