All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fat: release buffer head after rebuilding parent
@ 2026-07-15  2:09 Yichong Chen
  2026-07-15  6:00 ` OGAWA Hirofumi
  0 siblings, 1 reply; 2+ messages in thread
From: Yichong Chen @ 2026-07-15  2:09 UTC (permalink / raw)
  To: OGAWA Hirofumi
  Cc: Andrew Morton, Ravishankar N, Amit Sahrawat, Namjae Jeon,
	linux-kernel, Yichong Chen

fat_scan_logstart() leaves the matching directory entry's buffer head in
sinfo.bh for the caller to release, just like fat_scan().

fat_rebuild_parent() uses the directory entry to rebuild the parent inode
for the nostale_ro NFS export path, but does not release sinfo.bh after a
successful scan.  Release it once fat_build_inode() has consumed the
directory entry data.

Fixes: f1e6fb0ab451 ("fat (exportfs): rebuild directory-inode if fat_dget()")
Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
---
 fs/fat/nfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/fat/nfs.c b/fs/fat/nfs.c
index 509eea9..6e1b371 100644
--- a/fs/fat/nfs.c
+++ b/fs/fat/nfs.c
@@ -250,8 +250,10 @@ struct inode *fat_rebuild_parent(struct super_block *sb, int parent_logstart)
 		MSDOS_I(dummy_grand_parent)->i_pos = -1;
 	}
 
-	if (!fat_scan_logstart(dummy_grand_parent, clus_to_match, &sinfo))
+	if (!fat_scan_logstart(dummy_grand_parent, clus_to_match, &sinfo)) {
 		parent = fat_build_inode(sb, sinfo.de, sinfo.i_pos);
+		brelse(sinfo.bh);
+	}
 
 	brelse(parent_bh);
 	iput(dummy_grand_parent);
-- 
2.51.0


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

* Re: [PATCH] fat: release buffer head after rebuilding parent
  2026-07-15  2:09 [PATCH] fat: release buffer head after rebuilding parent Yichong Chen
@ 2026-07-15  6:00 ` OGAWA Hirofumi
  0 siblings, 0 replies; 2+ messages in thread
From: OGAWA Hirofumi @ 2026-07-15  6:00 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Yichong Chen, Ravishankar N, Amit Sahrawat, Namjae Jeon,
	linux-kernel

Yichong Chen <chenyichong@uniontech.com> writes:

> fat_scan_logstart() leaves the matching directory entry's buffer head in
> sinfo.bh for the caller to release, just like fat_scan().
>
> fat_rebuild_parent() uses the directory entry to rebuild the parent inode
> for the nostale_ro NFS export path, but does not release sinfo.bh after a
> successful scan.  Release it once fat_build_inode() has consumed the
> directory entry data.
>
> Fixes: f1e6fb0ab451 ("fat (exportfs): rebuild directory-inode if fat_dget()")
> Signed-off-by: Yichong Chen <chenyichong@uniontech.com>

Looks good, thanks.

Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

> ---
>  fs/fat/nfs.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/fat/nfs.c b/fs/fat/nfs.c
> index 509eea9..6e1b371 100644
> --- a/fs/fat/nfs.c
> +++ b/fs/fat/nfs.c
> @@ -250,8 +250,10 @@ struct inode *fat_rebuild_parent(struct super_block *sb, int parent_logstart)
>  		MSDOS_I(dummy_grand_parent)->i_pos = -1;
>  	}
>  
> -	if (!fat_scan_logstart(dummy_grand_parent, clus_to_match, &sinfo))
> +	if (!fat_scan_logstart(dummy_grand_parent, clus_to_match, &sinfo)) {
>  		parent = fat_build_inode(sb, sinfo.de, sinfo.i_pos);
> +		brelse(sinfo.bh);
> +	}
>  
>  	brelse(parent_bh);
>  	iput(dummy_grand_parent);

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

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

end of thread, other threads:[~2026-07-15  6:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-15  2:09 [PATCH] fat: release buffer head after rebuilding parent Yichong Chen
2026-07-15  6:00 ` OGAWA Hirofumi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.