xfs: drop the RTG reference later in xfs_ioc_rtgroup_geometry

Keep the rtgroup reference until after reporting the write pointer, as
that uses it.  Right now this is not a major issue as we don't support
shrinking file systems in a way that makes RTGs go away, but let's stick
to the proper reference counting to prepare for that.

Fixes: c6ce65cb17 ("xfs: add write pointer to xfs_rtgroup_geometry")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
Christoph Hellwig 2026-05-27 14:39:28 +02:00 committed by Carlos Maiolino
parent c3e0738943
commit c316bb56bf

View File

@ -433,9 +433,8 @@ xfs_ioc_rtgroup_geometry(
return -EINVAL;
error = xfs_rtgroup_get_geometry(rtg, &rgeo);
xfs_rtgroup_put(rtg);
if (error)
return error;
goto out_put_rtg;
if (xfs_has_zoned(mp)) {
xfs_rtgroup_lock(rtg, XFS_RTGLOCK_RMAP);
@ -453,8 +452,10 @@ xfs_ioc_rtgroup_geometry(
}
if (copy_to_user(arg, &rgeo, sizeof(rgeo)))
return -EFAULT;
return 0;
error = -EFAULT;
out_put_rtg:
xfs_rtgroup_put(rtg);
return error;
}
/*