Re: [PATCH] vfs: check dentry is still valid in get_link()

From: Al Viro
Date: Mon Jan 17 2022 - 22:48:01 EST


On Tue, Jan 18, 2022 at 02:00:41PM +1100, Dave Chinner wrote:
> > IOW, how far is xfs_inode_mark_reclaimable() from being callable in RCU
> > callback context?
>
> AIUI, not very close at all,
>
> I'm pretty sure we can't put it under RCU callback context at all
> because xfs_fs_destroy_inode() can take sleeping locks, perform
> transactions, do IO, run rcu_read_lock() critical sections, etc.
> This means that needs to run an a full task context and so can't run
> from RCU callback context at all.

Umm... AFAICS, this
pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino));
spin_lock(&pag->pag_ici_lock);
spin_lock(&ip->i_flags_lock);

trace_xfs_inode_set_reclaimable(ip);
ip->i_flags &= ~(XFS_NEED_INACTIVE | XFS_INACTIVATING);
ip->i_flags |= XFS_IRECLAIMABLE;
xfs_perag_set_inode_tag(pag, XFS_INO_TO_AGINO(mp, ip->i_ino),
XFS_ICI_RECLAIM_TAG);

spin_unlock(&ip->i_flags_lock);
spin_unlock(&pag->pag_ici_lock);
xfs_perag_put(pag);
in the end of xfs_inodegc_set_reclaimable() could go into ->free_inode()
just fine. It's xfs_inodegc_queue() I'm not sure about - the part
about flush_work() in there...

I'm not familiar with that code; could you point me towards some
docs/old postings/braindump/whatnot?