aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
authorChristoph Hellwig <hch@lst.de>2026-05-27 14:39:28 +0200
committerCarlos Maiolino <cem@kernel.org>2026-05-28 10:21:28 +0200
commit32da0ae8defd1d4dc30be66bb9b27911aa13b36c (patch)
tree86993783598dc3d47c02a30d4967a6ad7bbd0da6 /fs
parentc734e8bf321dd5280d6681af79dbf6d9f3abdbdc (diff)
downloadlinux-next-history-32da0ae8defd1d4dc30be66bb9b27911aa13b36c.tar.gz
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: c6ce65cb17aa ("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>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_ioctl.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 46e234863644f..737afcb5652ac 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -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;
}
/*