Re: [RFC] MNT_WRITE_HOLD mess

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

 



On Fri, 4 Jul 2025 at 12:44, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
>         What if we steal LSB of ->mnt_instance.prev for what MNT_WRITE_HOLD
> is currently used for?

Ugh. I don't hate the concept, but if we do this, I think it needs to
be better abstracted out.

And you may be right that things like list_for_each_entry() won't
care, but I would not be surprised there is list debugging code that
could care deeply. Or if anybody uses things like "list_is_first()",
it will work 99+_% of the time, but then break horribly if the low bit
of the prev pointer is set.

So we obviously use the low bits of pointers in many other situations,
but I do think that it needs to have some kind of clear abstraction
and type safety to make sure that people don't use the "normal" list
handling helpers silently by mistake when they won't actually work.

Yes, that tends to involve a fair amount of duplication - exactly like
<linux/list_bl.h>, which is obviously the exact same thing except it
uses the low bit of the list head rather than the list entry. But if
the uses are limited enough - and they obviously need to be limited to
things that never look at 'prev' - maybe that duplication can also be
fairly limited.

I suspect we should also have another level of abstraction - we do
those "low bits of pointer" things often enough now that we probably
should have actual helpers for it, rather than have people do the
whole "cast to unsigned long and extract/insert bits by hand".

But that's a separate issue and largely independent (except that you'd
introduce a new use-case).

            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