Re: [RFC 1/2] rwsem: introduce upgrade_read interface

Christoph Hellwig
2024-10-18T05:06:57Z

On Thu, Oct 17, 2024 at 01:36:41PM -0400, Waiman Long wrote:
> > At least for the XFS use case where direct I/O takes a share lock
> > that needs to be replaced with an exclusive one for certain kinds of
> > I/O would be useless. But then again we've survived without this
> > operation for a long time, despite the initial port bringing one over
> > from IRIX.
>
> That means XFS only needs to upgrade to a write lock in certain cases only,
> not all of them.

Yes. Basically when we detect a direct I/O writes needs to clear the
SUID bit or other metadata, or when it is an extending write.

> Right? In that case, read_try_upgrade() that attempts to
> upgrade to a write lock will be useful.

Yes. But I also understand Peters reasoning that it will be very hard
to actually have a useful implementation that does better than just
unlocking (which is what we do currently).