[Devel] [PATCH hci-8.1 v2 1/3] xfs: release the balloon inode when xfs_balloon_get() refuses it

Denis V. Lunev den at openvz.org
Wed Nov 11 01:27:53 MSK 2026


From: Denis V. Lunev <den at openvz.org>

xfs_balloon_get() looks the balloon inode up with xfs_iget() and returns
-EINVAL when it is not a regular file or is immutable, without
releasing the reference it took. Every statfs and every open of the
balloon then leaks a reference on such an inode, which the VFS reports
as a busy inode at unmount.

Release the inode before returning -EINVAL.

https://virtuozzo.atlassian.net/browse/VSTOR-153590

Feature: fs/xfs: fast online shrink support
Signed-off-by: Denis V. Lunev <den at openvz.org>
---
 fs/xfs/xfs_super.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index d24ceb045364..6deab3e5d76c 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -924,8 +924,10 @@ xfs_balloon_get(struct xfs_mount *mp, u64 balloon_ino, uint flags)
 	if (error)
 		return ERR_PTR(error);
 	inode = VFS_I(ip);
-	if (!S_ISREG(inode->i_mode) || IS_IMMUTABLE(inode))
+	if (!S_ISREG(inode->i_mode) || IS_IMMUTABLE(inode)) {
+		xfs_irele(ip);
 		return ERR_PTR(-EINVAL);
+	}
 
 	return ip;
 }
-- 
2.53.0



More information about the Devel mailing list