On Mon, 16 Jun 2025 at 13:38, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote: > > Folks, how much would you hate the following trick: > > lock_mount(path, &m) returning void, and indicating error by storing > ERR_PTR(-E...) into m.path; unlock_mount(&m) doing nothing if IS_ERR(m.mp); > users turned into > > scoped_guard(lock_mount, mp)(path) { > if (IS_ERR(mp.mp)) > return ERR_PTR(mp.mp); > .... > } Eww. It feels like using 'scoped_cond_guard()' is the *much* more appropriate model, even if that interface is kind of disgusting. The it would literally become scoped_cond_guard(lock_mount, return ERR_PTR(mp.mp), mp, path) { except I do admit that our "cond" guard syntax is horribly nasty - see the several threads people have had about trying to make them better. You've been cc'd on at least some of them. Maybe using lock_mount() could help figure out what the right syntax for the conditional guards are. Linus