Re: [PATCH 01/12] xfs: attr fork iext must be loaded before calling xfs_attr_is_leaf

Darrick J. Wong
2024-04-10T20:58:15Z

On Tue, Apr 09, 2024 at 10:04:11PM -0700, Christoph Hellwig wrote:
> On Tue, Apr 09, 2024 at 05:50:38PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > Christoph noticed that the xfs_attr_is_leaf in xfs_attr_get_ilocked can
> > access the incore extent tree of the attr fork, but nothing in the
> > xfs_attr_get path guarantees that the incore tree is actually loaded.
> >
> > Most of the time it is, but seeing as xfs_attr_is_leaf ignores the
> > return value of xfs_iext_get_extent I guess we've been making choices
> > based on random stack contents and nobody's complained?
>
> Yes, I'm kinda puzzled.

I suspect that most of the time we get lucky and *someone* has read in
the attr fork or created it or whatever.

> Note that the dir code actually reads the extents in their
> is_leaf/is_block helpers. But given how the attr code is structured
> that would thread through a lot of code so it might not be worth it.

<nod> But it would be more consistent...

> Reviewed-by: Christoph Hellwig <hch@lst.de>

Thanks!

--D