Re: [GIT PULL] vfs mount

Linus Torvalds
2025-04-04T14:19:47Z

On Fri, 4 Apr 2025 at 01:28, Christoph Hellwig <hch@infradead.org> wrote:
>
> Or just kill the non-scoped guard because it simply is an insane API.

The scoped guard may be odd, but it's actually rather a common
situation. And when used with the proper indentation, it also ends up
being pretty visually clear about what part of a function is under the
lock.

But yeah, if you don't end up using it right, it ends up very very wrong.

Not that that is any different from "if ()" or any other similar
construct, but obviously people are much more *used* to 'if ()' and
friends.

An 'if ()" without the nested statement looks very wrong - although
it's certainly not unheard of - while a 'scoped_guard()' without the
nested statement might visually pass just because it doesn't trigger
the same visceral "that's not right" reaction.

So I don't think it's an insane API, I think it's mostly that it's a
_newish_ API.

Linus