On Wed, Jul 16, 2025 at 03:03:19PM +0200, Christoph Hellwig wrote: > Split up the XFS_IS_CORRUPT statement so that it immediately shows > if the reference counter overflowed or underflowed. Should we be using refcount_t for xg_active_ref to detect over/underflows, then? > I ran into this quite a bit when developing the zoned allocator, and had > to reapply the patch for some work recently. We might as well just apply > it upstream given that freeing group is far removed from performance > critical code. > > Signed-off-by: Christoph Hellwig <hch@xxxxxx> Looks fine though, Reviewed-by: "Darrick J. Wong" <djwong@xxxxxxxxxx> --D > --- > fs/xfs/libxfs/xfs_group.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/fs/xfs/libxfs/xfs_group.c b/fs/xfs/libxfs/xfs_group.c > index 20ad7c309489..792f76d2e2a0 100644 > --- a/fs/xfs/libxfs/xfs_group.c > +++ b/fs/xfs/libxfs/xfs_group.c > @@ -172,7 +172,8 @@ xfs_group_free( > > /* drop the mount's active reference */ > xfs_group_rele(xg); > - XFS_IS_CORRUPT(mp, atomic_read(&xg->xg_active_ref) != 0); > + XFS_IS_CORRUPT(mp, atomic_read(&xg->xg_active_ref) > 0); > + XFS_IS_CORRUPT(mp, atomic_read(&xg->xg_active_ref) < 0); > kfree_rcu_mightsleep(xg); > } > > -- > 2.47.2 > >