From: Chao Yu <yuchao0@huawei.com>
To: Daeho Jeong <daeho43@gmail.com>, <linux-kernel@vger.kernel.org>,
<linux-f2fs-devel@lists.sourceforge.net>,
<kernel-team@android.com>
Cc: Colin Ian King <colin.king@canonical.com>,
Daeho Jeong <daehojeong@google.com>
Subject: Re: [f2fs-dev] [PATCH] f2fs: fix null page reference in redirty_blocks
Date: Tue, 5 Jan 2021 09:44:26 +0800 [thread overview]
Message-ID: <904b7677-3655-2e81-52e0-48296cf1c0da@huawei.com> (raw)
In-Reply-To: <20210105012826.956800-1-daeho43@gmail.com>
On 2021/1/5 9:28, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@google.com>
>
> Fixed null page reference when find_lock_page() fails in
> redirty_blocks().
>
> Signed-off-by: Daeho Jeong <daehojeong@google.com>
> Reported-by: Colin Ian King <colin.king@canonical.com>
> Fixes: 5fdb322ff2c2 ("f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE")
> ---
> fs/f2fs/file.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 9e5275716be8..bf6682a52433 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -4060,8 +4060,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)
> + if (!page) {
> ret = -ENOENT;
ret = -ENOMEM;
> + continue;
How about breaking the loop for out-of-memory case, because in such condition
we have less chance to dirty whole cluster due to no memory, and continue to
allocate pages for target file will make system suffer more memory pressure,
it will make many thing slower.
Thnaks,
> + }
> set_page_dirty(page);
> f2fs_put_page(page, 1);
> f2fs_put_page(page, 0);
>
next prev parent reply other threads:[~2021-01-05 1:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-05 1:28 Daeho Jeong
2021-01-05 1:44 ` Chao Yu [this message]
2021-01-05 2:10 ` [f2fs-dev] " Daeho Jeong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=904b7677-3655-2e81-52e0-48296cf1c0da@huawei.com \
--to=yuchao0@huawei.com \
--cc=colin.king@canonical.com \
--cc=daeho43@gmail.com \
--cc=daehojeong@google.com \
--cc=kernel-team@android.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®