Re: [PATCH 25/26] xfs: rework unreferenced inode lookups

Peter Zijlstra
2019-10-11T13:39:40Z

On Fri, Oct 11, 2019 at 05:55:22AM -0700, Christoph Hellwig wrote:
> On Wed, Oct 09, 2019 at 02:21:23PM +1100, Dave Chinner wrote:

> > @@ -131,6 +132,7 @@ xfs_inode_free(
> > * free state. The ip->i_flags_lock provides the barrier against lookup
> > * races.
> > */
> > + xfs_ilock(ip, XFS_ILOCK_EXCL);
>
> This introduceѕ a non-owner unlock of an exclusively held rwsem. As-is
> this will make lockdep very unhappy. We have a non-owner unlock version
> of up_read, but not of up_write currently. I'm also not sure if those
> are allowed from RCU callback, which IIRC can run from softirq context.
>
> That being said this scheme of only unlocking the inode in the rcu free
> callback makes totaly sense to me, so I wish we can accomodate it
> somehow.

I'm thinking that, barring the little issue of not actually having the
function, up_write_non_owner() should work from RCU callback context.
That is, I don't see rwsem_wake() do anything not allowed there.