mnt_hold_writers(9)
Bestie, welcome to mnt_hold_writers(9) from the Kernel API Manual β the page that says βhey, hold upβ to write access on a mount π
β¨
πΈ NAME πΈ
mnt_hold_writers β prevent write access to the given mount.
β¨ SYNOPSIS β¨
int mnt_hold_writers (struct mount *mnt );
π ARGUMENTS π
mntβ themntyou want to prevent write access to, bestie. That's the whole argument.
π¦ DESCRIPTION π¦
Okay so here's the tea: this function prevents write access to mnt if there are no active writers for mnt. It has to be called and return successfully before you go changing properties of mnt that need to remain stable for callers with write access to mnt. No skipping steps, okay? π
After this function has been called successfully, callers must pair it with a call to mnt_unhold_writers to stop preventing write access to mnt. It's giving lock/unlock energy, but with mount writers. πβ¨
π§ CONTEXT π§
This function expects to be in mount_locked_reader scope, serializing setting WRITE_HOLD. That's the vibe it needs. Periodt.
π« RETURN π«
On success, 0 is returned. On error, -EBUSY is returned. That's it, that's the whole return moment.
π₯ SEE ALSO π₯
Kernel file ./fs/namespace.c, plus all these iconic besties:
mnt_get_write_access(9)mnt_want_write(9)mnt_get_write_access_file(9)mnt_want_write_file(9)mnt_put_write_access(9)mnt_drop_write(9)mnt_unhold_writers(9)__lookup_mnt(9)lookup_mnt(9)attach_mnt(9)vfs_create_mount(9)path_is_mountpoint(9)may_umount_tree(9)may_umount(9)clone_private_mount(9)attach_recursive_mnt(9)do_lock_mount(9)path_overmounted(9)can_move_mount_beneath(9)mnt_set_expiry(9)mnt_allow_writers(9)
Signed, sealed, and sourced from ./fs π dated October 2026 and forever known as mnt_hold_writers(9) π«Ά
π¦ 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