On Wed, Jun 11, 2025 at 07:47:00PM +0100, Al Viro wrote: > On Wed, Jun 11, 2025 at 01:19:43PM +0200, Christian Brauner wrote: > > > This feels well-suited for a DEFINE_FREE based annotation so that > > unpin_mountpoint() is called when the scope ends. > > FWIW, I'd be more interested in having unlock_mount() treated that > way, but I'm not sure what syntax would make sense there. > > scoped_cond_guard() is not a good fit, unfortunately... 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); .... }