* [PATCH] f2fs: fix null page reference in redirty_blocks
@ 2021-01-05 1:28 Daeho Jeong
2021-01-05 1:44 ` [f2fs-dev] " Chao Yu
0 siblings, 1 reply; 3+ messages in thread
From: Daeho Jeong @ 2021-01-05 1:28 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Daeho Jeong, Colin Ian King
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;
+ continue;
+ }
set_page_dirty(page);
f2fs_put_page(page, 1);
f2fs_put_page(page, 0);
--
2.29.2.729.g45daf8777d-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: fix null page reference in redirty_blocks
2021-01-05 1:28 [PATCH] f2fs: fix null page reference in redirty_blocks Daeho Jeong
@ 2021-01-05 1:44 ` Chao Yu
2021-01-05 2:10 ` Daeho Jeong
0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu @ 2021-01-05 1:44 UTC (permalink / raw)
To: Daeho Jeong, linux-kernel, linux-f2fs-devel, kernel-team
Cc: Colin Ian King, Daeho Jeong
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);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: fix null page reference in redirty_blocks
2021-01-05 1:44 ` [f2fs-dev] " Chao Yu
@ 2021-01-05 2:10 ` Daeho Jeong
0 siblings, 0 replies; 3+ messages in thread
From: Daeho Jeong @ 2021-01-05 2:10 UTC (permalink / raw)
To: Chao Yu
Cc: linux-kernel, linux-f2fs-devel, kernel-team, Colin Ian King, Daeho Jeong
Yes, it's better~ :)
2021년 1월 5일 (화) 오전 10:44, Chao Yu <yuchao0@huawei.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);
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-05 2:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-05 1:28 [PATCH] f2fs: fix null page reference in redirty_blocks Daeho Jeong
2021-01-05 1:44 ` [f2fs-dev] " Chao Yu
2021-01-05 2:10 ` Daeho Jeong
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).