f2fs: fix null page reference in redirty_blocks
PATCH 1/1 f2fs: fix null page reference in redirty_blocks
From: Daeho Jeong <[email protected]>
Fixed null page reference when find_lock_page() fails in redirty_blocks().
--- fs/f2fs/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/f2fs/file.c +3 -1
@@ -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 );
Signature · 8 lines
2.29.2.729.g45daf8777d-goog _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 17 lines · Daeho Jeong
From: Daeho Jeong <[email protected]>
Fixed null page reference when
find_lock_page()fails inredirty_blocks().Signed-off-by Daeho Jeong <[email protected]>Reported-by Colin Ian King <[email protected]>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(-)fs/f2fs/file.c +0
-0
fs/f2fs/file.c static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len) · line 4064
Quoted 6 lines
fs/f2fs/file.c +1
-1@@ -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;
fs/f2fs/file.c static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len) · line 4065
Quoted 1 line
fs/f2fs/file.c +1
-0+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,
fs/f2fs/file.c static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len) · line 4069
Quoted 5 lines
fs/f2fs/file.c +1
-0+ }set_page_dirty (page);f2fs_put_page (page,1 );f2fs_put_page (page,0 );
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Yes, it's better~ :)
2021년 1월 5일 (화) 오전 10:44, Chao Yu <[email protected]>님이 작성:
Quoted 28 lines · Daeho Jeong
Quoted 17 lines
From: Daeho Jeong <[email protected]>
Fixed null page reference when
find_lock_page()fails inredirty_blocks().Signed-off-by Daeho Jeong <[email protected]>Reported-by Colin Ian King <[email protected]>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(-)fs/f2fs/file.c +0
-0fs/f2fs/file.c static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len) · line 4064
Quoted 6 lines
fs/f2fs/file.c +1
-1@@ -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;
Quoted 14 lines
fs/f2fs/file.c static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len) · line 4065
Quoted 1 line
fs/f2fs/file.c +1
-0+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,
Quoted 5 lines
fs/f2fs/file.c +1
-0+ }set_page_dirty (page);f2fs_put_page (page,1 );f2fs_put_page (page,0 );
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel