Linux XFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] xfs: release alleged child inode on metapath unlink error
       [not found] <CGME20260831064229epcas5p3825244c86e28b11019cdd2ce90c16eff@epcas5p3.samsung.com>
@ 2026-08-31  6:41 ` Anuj Gupta
  2026-08-31  8:53   ` Carlos Maiolino
  2026-08-31 14:16   ` Darrick J. Wong
  0 siblings, 2 replies; 4+ messages in thread
From: Anuj Gupta @ 2026-08-31  6:41 UTC (permalink / raw)
  To: djwong, hch, cem; +Cc: linux-xfs, Anuj Gupta

If xchk_metapath_ilock_parent_and_child() fails after xchk_iget()
succeeds, release the inode reference before returning.

Fixes: 0d2c636e489c ("xfs: repair metadata directory file path connectivity")
Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
---
 fs/xfs/scrub/metapath.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/xfs/scrub/metapath.c b/fs/xfs/scrub/metapath.c
index ff1ff762b300..79fd69d2de68 100644
--- a/fs/xfs/scrub/metapath.c
+++ b/fs/xfs/scrub/metapath.c
@@ -550,6 +550,8 @@ xrep_metapath_try_unlink(
 	}
 	if (error) {
 		xchk_trans_cancel(sc);
+		if (ip)
+			xchk_irele(sc, ip);
 		return error;
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: release alleged child inode on metapath unlink error
  2026-08-31  6:41 ` [PATCH] xfs: release alleged child inode on metapath unlink error Anuj Gupta
@ 2026-08-31  8:53   ` Carlos Maiolino
  2026-08-31 14:16   ` Darrick J. Wong
  1 sibling, 0 replies; 4+ messages in thread
From: Carlos Maiolino @ 2026-08-31  8:53 UTC (permalink / raw)
  To: Anuj Gupta; +Cc: djwong, hch, linux-xfs

On Mon, Aug 31, 2026 at 12:11:57PM +0530, Anuj Gupta wrote:
> If xchk_metapath_ilock_parent_and_child() fails after xchk_iget()
> succeeds, release the inode reference before returning.
> 
> Fixes: 0d2c636e489c ("xfs: repair metadata directory file path connectivity")
> Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
> ---
>  fs/xfs/scrub/metapath.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/xfs/scrub/metapath.c b/fs/xfs/scrub/metapath.c
> index ff1ff762b300..79fd69d2de68 100644
> --- a/fs/xfs/scrub/metapath.c
> +++ b/fs/xfs/scrub/metapath.c
> @@ -550,6 +550,8 @@ xrep_metapath_try_unlink(
>  	}
>  	if (error) {
>  		xchk_trans_cancel(sc);
> +		if (ip)
> +			xchk_irele(sc, ip);
>  		return error;
>  	}
>  

Looks good.

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

> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: release alleged child inode on metapath unlink error
  2026-08-31  6:41 ` [PATCH] xfs: release alleged child inode on metapath unlink error Anuj Gupta
  2026-08-31  8:53   ` Carlos Maiolino
@ 2026-08-31 14:16   ` Darrick J. Wong
  2026-09-01  5:44     ` Anuj Gupta/Anuj Gupta
  1 sibling, 1 reply; 4+ messages in thread
From: Darrick J. Wong @ 2026-08-31 14:16 UTC (permalink / raw)
  To: Anuj Gupta; +Cc: hch, cem, linux-xfs

On Mon, Aug 31, 2026 at 12:11:57PM +0530, Anuj Gupta wrote:
> If xchk_metapath_ilock_parent_and_child() fails after xchk_iget()
> succeeds, release the inode reference before returning.
> 
> Fixes: 0d2c636e489c ("xfs: repair metadata directory file path connectivity")

I have a patch just like this one in my branch so

Cc: <stable@vger.kernel.org> # v6.13
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
> ---
>  fs/xfs/scrub/metapath.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/xfs/scrub/metapath.c b/fs/xfs/scrub/metapath.c
> index ff1ff762b300..79fd69d2de68 100644
> --- a/fs/xfs/scrub/metapath.c
> +++ b/fs/xfs/scrub/metapath.c
> @@ -550,6 +550,8 @@ xrep_metapath_try_unlink(
>  	}
>  	if (error) {
>  		xchk_trans_cancel(sc);
> +		if (ip)
> +			xchk_irele(sc, ip);
>  		return error;
>  	}
>  
> -- 
> 2.25.1
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfs: release alleged child inode on metapath unlink error
  2026-08-31 14:16   ` Darrick J. Wong
@ 2026-09-01  5:44     ` Anuj Gupta/Anuj Gupta
  0 siblings, 0 replies; 4+ messages in thread
From: Anuj Gupta/Anuj Gupta @ 2026-09-01  5:44 UTC (permalink / raw)
  To: Darrick J. Wong, cem; +Cc: hch, linux-xfs

On 8/31/2026 7:46 PM, Darrick J. Wong wrote:
> On Mon, Aug 31, 2026 at 12:11:57PM +0530, Anuj Gupta wrote:
>> If xchk_metapath_ilock_parent_and_child() fails after xchk_iget()
>> succeeds, release the inode reference before returning.
>>
>> Fixes: 0d2c636e489c ("xfs: repair metadata directory file path connectivity")
> 
> I have a patch just like this one in my branch so
> 
> Cc: <stable@vger.kernel.org> # v6.13
> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
> 

I noticed that the hunk was placed in the wrong location. It belongs 
after xchk_metapath_ilock_parent_and_child() where the leak can occur. 
The implementation doesn't match the commit description. Really sorry 
for the noise; I will send a v2.

> --D
> 
>> Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
>> ---
>>   fs/xfs/scrub/metapath.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/fs/xfs/scrub/metapath.c b/fs/xfs/scrub/metapath.c
>> index ff1ff762b300..79fd69d2de68 100644
>> --- a/fs/xfs/scrub/metapath.c
>> +++ b/fs/xfs/scrub/metapath.c
>> @@ -550,6 +550,8 @@ xrep_metapath_try_unlink(
>>   	}
>>   	if (error) {
>>   		xchk_trans_cancel(sc);
>> +		if (ip)
>> +			xchk_irele(sc, ip);
>>   		return error;
>>   	}
>>   
>> -- 
>> 2.25.1
>>
>>
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-01  5:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20260831064229epcas5p3825244c86e28b11019cdd2ce90c16eff@epcas5p3.samsung.com>
2026-08-31  6:41 ` [PATCH] xfs: release alleged child inode on metapath unlink error Anuj Gupta
2026-08-31  8:53   ` Carlos Maiolino
2026-08-31 14:16   ` Darrick J. Wong
2026-09-01  5:44     ` Anuj Gupta/Anuj Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox