linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] f2fs: optimize error handling in redirty_blocks
@ 2022-05-31  1:16 Jack Qiu via Linux-f2fs-devel
  2022-05-31  8:09 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Jack Qiu via Linux-f2fs-devel @ 2022-05-31  1:16 UTC (permalink / raw)
  To: linux-f2fs-devel

Current error handling is at risk of page leaks. However, we dot't seek
any failure scenarios, just use f2fs_bug_on.

Signed-off-by: Jack Qiu <jack.qiu@huawei.com>
---
 fs/f2fs/file.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 100637b1adb3..edb03945ad36 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -3968,10 +3968,10 @@ static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len)

 	for (i = 0; i < page_len; i++, redirty_idx++) {
 		page = find_lock_page(mapping, redirty_idx);
-		if (!page) {
-			ret = -ENOMEM;
-			break;
-		}
+
+		/* It will never fail, when page has pinned above */
+		f2fs_bug_on(sbi, !page);
+
 		set_page_dirty(page);
 		f2fs_put_page(page, 1);
 		f2fs_put_page(page, 0);
--
2.31.1



_______________________________________________
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] 2+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: optimize error handling in redirty_blocks
  2022-05-31  1:16 [f2fs-dev] [PATCH] f2fs: optimize error handling in redirty_blocks Jack Qiu via Linux-f2fs-devel
@ 2022-05-31  8:09 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2022-05-31  8:09 UTC (permalink / raw)
  To: Jack Qiu, linux-f2fs-devel

On 2022/5/31 9:16, Jack Qiu via Linux-f2fs-devel wrote:
> Current error handling is at risk of page leaks. However, we dot't seek
> any failure scenarios, just use f2fs_bug_on.
> 
> Signed-off-by: Jack Qiu <jack.qiu@huawei.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,


_______________________________________________
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] 2+ messages in thread

end of thread, other threads:[~2022-05-31  8:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-31  1:16 [f2fs-dev] [PATCH] f2fs: optimize error handling in redirty_blocks Jack Qiu via Linux-f2fs-devel
2022-05-31  8:09 ` 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).