linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: fix to unlock page correctly in error path of is_alive()
@ 2022-02-03 14:47 Chao Yu
  2022-02-03 20:03 ` Jaegeuk Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu @ 2022-02-03 14:47 UTC (permalink / raw)
  To: jaegeuk; +Cc: Pavel Machek, linux-kernel, linux-f2fs-devel

As Pavel Machek reported in below link [1]:

After commit 77900c45ee5c ("f2fs: fix to do sanity check in is_alive()"),
node page should be unlock via calling f2fs_put_page() in the error path
of is_alive(), otherwise, f2fs may hang when it tries to lock the node
page, fix it.

[1] https://lore.kernel.org/stable/20220124203637.GA19321@duo.ucw.cz/

Fixes: 77900c45ee5c ("f2fs: fix to do sanity check in is_alive()")
Reported-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Chao Yu <chao@kernel.org>
---
 fs/f2fs/gc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 0a6b0a8ae97e..2d53ef121e76 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -1038,8 +1038,10 @@ static bool is_alive(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
 		set_sbi_flag(sbi, SBI_NEED_FSCK);
 	}
 
-	if (f2fs_check_nid_range(sbi, dni->ino))
+	if (f2fs_check_nid_range(sbi, dni->ino)) {
+		f2fs_put_page(node_page, 1);
 		return false;
+	}
 
 	*nofs = ofs_of_node(node_page);
 	source_blkaddr = data_blkaddr(NULL, node_page, ofs_in_node);
-- 
2.32.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: fix to unlock page correctly in error path of is_alive()
  2022-02-03 14:47 [f2fs-dev] [PATCH] f2fs: fix to unlock page correctly in error path of is_alive() Chao Yu
@ 2022-02-03 20:03 ` Jaegeuk Kim
  2022-02-04  3:19   ` Chao Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Jaegeuk Kim @ 2022-02-03 20:03 UTC (permalink / raw)
  To: Chao Yu; +Cc: Pavel Machek, linux-kernel, linux-f2fs-devel

On 02/03, Chao Yu wrote:
> As Pavel Machek reported in below link [1]:
> 
> After commit 77900c45ee5c ("f2fs: fix to do sanity check in is_alive()"),
> node page should be unlock via calling f2fs_put_page() in the error path
> of is_alive(), otherwise, f2fs may hang when it tries to lock the node
> page, fix it.
> 
> [1] https://lore.kernel.org/stable/20220124203637.GA19321@duo.ucw.cz/

Need -stable? It seems 4.19+?

> 
> Fixes: 77900c45ee5c ("f2fs: fix to do sanity check in is_alive()")
> Reported-by: Pavel Machek <pavel@denx.de>
> Signed-off-by: Pavel Machek <pavel@denx.de>
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
>  fs/f2fs/gc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index 0a6b0a8ae97e..2d53ef121e76 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -1038,8 +1038,10 @@ static bool is_alive(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
>  		set_sbi_flag(sbi, SBI_NEED_FSCK);
>  	}
>  
> -	if (f2fs_check_nid_range(sbi, dni->ino))
> +	if (f2fs_check_nid_range(sbi, dni->ino)) {
> +		f2fs_put_page(node_page, 1);
>  		return false;
> +	}
>  
>  	*nofs = ofs_of_node(node_page);
>  	source_blkaddr = data_blkaddr(NULL, node_page, ofs_in_node);
> -- 
> 2.32.0


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: fix to unlock page correctly in error path of is_alive()
  2022-02-03 20:03 ` Jaegeuk Kim
@ 2022-02-04  3:19   ` Chao Yu
  0 siblings, 0 replies; 3+ messages in thread
From: Chao Yu @ 2022-02-04  3:19 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: Pavel Machek, linux-kernel, linux-f2fs-devel

On 2022/2/4 4:03, Jaegeuk Kim wrote:
> On 02/03, Chao Yu wrote:
>> As Pavel Machek reported in below link [1]:
>>
>> After commit 77900c45ee5c ("f2fs: fix to do sanity check in is_alive()"),
>> node page should be unlock via calling f2fs_put_page() in the error path
>> of is_alive(), otherwise, f2fs may hang when it tries to lock the node
>> page, fix it.
>>
>> [1] https://lore.kernel.org/stable/20220124203637.GA19321@duo.ucw.cz/
> 
> Need -stable? It seems 4.19+?

It depends on where commit 77900c45ee5c ("f2fs: fix to do sanity check in is_alive()")
be backported to? Anyway, let me Cc stable-kernel mailing list.

Thanks,

> 
>>
>> Fixes: 77900c45ee5c ("f2fs: fix to do sanity check in is_alive()")
>> Reported-by: Pavel Machek <pavel@denx.de>
>> Signed-off-by: Pavel Machek <pavel@denx.de>
>> Signed-off-by: Chao Yu <chao@kernel.org>
>> ---
>>   fs/f2fs/gc.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
>> index 0a6b0a8ae97e..2d53ef121e76 100644
>> --- a/fs/f2fs/gc.c
>> +++ b/fs/f2fs/gc.c
>> @@ -1038,8 +1038,10 @@ static bool is_alive(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
>>   		set_sbi_flag(sbi, SBI_NEED_FSCK);
>>   	}
>>   
>> -	if (f2fs_check_nid_range(sbi, dni->ino))
>> +	if (f2fs_check_nid_range(sbi, dni->ino)) {
>> +		f2fs_put_page(node_page, 1);
>>   		return false;
>> +	}
>>   
>>   	*nofs = ofs_of_node(node_page);
>>   	source_blkaddr = data_blkaddr(NULL, node_page, ofs_in_node);
>> -- 
>> 2.32.0


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

end of thread, other threads:[~2022-02-04  3:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-03 14:47 [f2fs-dev] [PATCH] f2fs: fix to unlock page correctly in error path of is_alive() Chao Yu
2022-02-03 20:03 ` Jaegeuk Kim
2022-02-04  3:19   ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).