diff mbox series

[1/3] xfs: fix a missing unlock in xfs_growfs_data

Message ID 20250317054512.1131950-2-hch@lst.de (mailing list archive)
State Accepted
Headers show
Series [1/3] xfs: fix a missing unlock in xfs_growfs_data | expand

Commit Message

hch March 17, 2025, 5:44 a.m. UTC
The newly added check for the internal RT device needs to unlock
m_growlock just like all ther other error cases.

Fixes: bdc03eb5f98f ("xfs: allow internal RT devices for zoned mode")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_fsops.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Carlos Maiolino March 18, 2025, 11:54 a.m. UTC | #1
On Mon, Mar 17, 2025 at 06:44:52AM +0100, Christoph Hellwig wrote:
> The newly added check for the internal RT device needs to unlock
> m_growlock just like all ther other error cases.
> 
> Fixes: bdc03eb5f98f ("xfs: allow internal RT devices for zoned mode")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>

> ---
>  fs/xfs/xfs_fsops.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
> index ee2cefbd5df8..d7658b7dcdbd 100644
> --- a/fs/xfs/xfs_fsops.c
> +++ b/fs/xfs/xfs_fsops.c
> @@ -301,7 +301,7 @@ xfs_growfs_data(
>  	struct xfs_mount	*mp,
>  	struct xfs_growfs_data	*in)
>  {
> -	int			error = 0;
> +	int			error;
> 
>  	if (!capable(CAP_SYS_ADMIN))
>  		return -EPERM;
> @@ -309,8 +309,10 @@ xfs_growfs_data(
>  		return -EWOULDBLOCK;
> 
>  	/* we can't grow the data section when an internal RT section exists */
> -	if (in->newblocks != mp->m_sb.sb_dblocks && mp->m_sb.sb_rtstart)
> -		return -EINVAL;
> +	if (in->newblocks != mp->m_sb.sb_dblocks && mp->m_sb.sb_rtstart) {
> +		error = -EINVAL;
> +		goto out_error;
> +	}
> 
>  	/* update imaxpct separately to the physical grow of the filesystem */
>  	if (in->imaxpct != mp->m_sb.sb_imax_pct) {
> --
> 2.45.2
>
Carlos Maiolino March 24, 2025, 8:52 a.m. UTC | #2
On Mon, 17 Mar 2025 06:44:52 +0100, Christoph Hellwig wrote:
> The newly added check for the internal RT device needs to unlock
> m_growlock just like all ther other error cases.
> 
> 

Applied to for-next, thanks!

[1/3] xfs: fix a missing unlock in xfs_growfs_data
      commit: beba9487138151c17dec17105364b35935f21562
[2/3] xfs: don't increment m_generation for all errors in xfs_growfs_data
      commit: 9ec3f7977a32f2045ef14445f165bcd96e596344
[3/3] xfs: don't wake zone space waiters without m_zone_info
      commit: f56f73ebf8bb13d72b93e490c1f175a0a2c836f2

Best regards,
diff mbox series

Patch

diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index ee2cefbd5df8..d7658b7dcdbd 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -301,7 +301,7 @@  xfs_growfs_data(
 	struct xfs_mount	*mp,
 	struct xfs_growfs_data	*in)
 {
-	int			error = 0;
+	int			error;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
@@ -309,8 +309,10 @@  xfs_growfs_data(
 		return -EWOULDBLOCK;
 
 	/* we can't grow the data section when an internal RT section exists */
-	if (in->newblocks != mp->m_sb.sb_dblocks && mp->m_sb.sb_rtstart)
-		return -EINVAL;
+	if (in->newblocks != mp->m_sb.sb_dblocks && mp->m_sb.sb_rtstart) {
+		error = -EINVAL;
+		goto out_error;
+	}
 
 	/* update imaxpct separately to the physical grow of the filesystem */
 	if (in->imaxpct != mp->m_sb.sb_imax_pct) {