may_grant(9)
π may_grant β kernel API manual, bestie edition β¨
okay so this is may_grant from the gfs2 glock corner of the kernel, and yes we're getting into it π«Ά
πΈ NAME πΈ
may_grant β check if it's ok to grant a new lock π₯
β¨ SYNOPSIS β¨
bool may_grant (struct gfs2_glock *gl , struct gfs2_holder *current_gh ,
struct gfs2_holder *gh );
like, it returns a bool, it takes three things, that's the whole vibe π
π ARGUMENTS π
glβ The glock π this is the main character of the whole situation nglcurrent_ghβ One of the current holders ofglπ«Ά literally just one of them, we'll get to why any of them worksghβ The lock request which we wish to grant π the new kid asking to sit with us
π¦ DESCRIPTION π¦
okay so here's the tea β with our current compatibility rules, if a glock has one or more active holders (that's the HIF_HOLDER flag being set, iykyk), any of those holders can be passed in as current_gh. literally any of them. they are all the same as far as compatibility with the new gh goes π like it does not matter which one you hand over, the answer comes out identical.
Returns true if it's ok to grant the lock β¨ that's it, that's the whole function, and honestly? iconic.
π SEE ALSO π
Kernel file ./fs/gfs2/glock.c, plus the whole extended friend group:
wake_up_glock(9)gfs2_glock_hold(9)gfs2_glock_put(9)do_error(9)find_first_holder(9)do_promote(9)find_first_waiter(9)find_last_waiter(9)state_change(9)finish_xmote(9)do_xmote(9)run_queue(9)glock_set_object(9)glock_clear_object(9)gfs2_glock_get(9)__gfs2_holder_init(9)gfs2_holder_reinit(9)gfs2_holder_uninit(9)gfs2_glock_holder_ready(9)gfs2_glock_wait(9)gfs2_glock_async_wait(9)request_demote(9)add_to_queue(9)gfs2_glock_nq(9)gfs2_glock_poll(9)gfs2_glock_dq(9)gfs2_glock_dq_uninit(9)gfs2_glock_nq_num(9)glock_compare(9)nq_m_sync(9)gfs2_glock_nq_m(9)gfs2_glock_dq_m(9)gfs2_should_freeze(9)gfs2_glock_complete(9)glock_hash_walk(9)thaw_glock(9)gfs2_glock_thaw(9)gfs2_wait_glocks(9)dump_holder(9)gfs2_dump_glock(9)
and that's the page bestie π brought to you from ./fs/gfs2, dated October 2026, and it's still called may_grant(9) because we don't do name changes around here π slay π
π¦ 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