Re: [PATCH 25/26] get rid of mountpoint->m_count

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux