linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* Re: [f2fs-dev] [PATCH] f2fs: fix to avoid page count leak
@ 2020-04-10 19:19 Markus Elfring
  2020-04-13  0:34 ` Chao Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2020-04-10 19:19 UTC (permalink / raw)
  To: Chao Yu, linux-f2fs-devel; +Cc: Jaegeuk Kim, linux-kernel

> In below error path, we missed to release reference count of pages
> in compressed cluster, fix it.
> - f2fs_mpage_readpages()
>  - f2fs_read_multi_pages()

I suggest to improve the commit message.

Would you like to add the tag “Fixes” to the change description?

Regards,
Markus


_______________________________________________
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 avoid page count leak
  2020-04-10 19:19 [f2fs-dev] [PATCH] f2fs: fix to avoid page count leak Markus Elfring
@ 2020-04-13  0:34 ` Chao Yu
  0 siblings, 0 replies; 3+ messages in thread
From: Chao Yu @ 2020-04-13  0:34 UTC (permalink / raw)
  To: Markus Elfring, linux-f2fs-devel; +Cc: Jaegeuk Kim, linux-kernel

On 2020/4/11 3:19, Markus Elfring wrote:
>> In below error path, we missed to release reference count of pages
>> in compressed cluster, fix it.
>> - f2fs_mpage_readpages()
>>  - f2fs_read_multi_pages()
> 
> I suggest to improve the commit message.
> 
> Would you like to add the tag “Fixes” to the change description?

Sure, will update in v2, thanks.

Thanks,

> 
> Regards,
> Markus
> .
> 


_______________________________________________
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

* [f2fs-dev] [PATCH] f2fs: fix to avoid page count leak
@ 2020-04-10  8:51 Chao Yu
  0 siblings, 0 replies; 3+ messages in thread
From: Chao Yu @ 2020-04-10  8:51 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-kernel, linux-f2fs-devel

In below error path, we missed to release reference count of pages
in compressed cluster, fix it.
- f2fs_mpage_readpages()
 - f2fs_read_multi_pages()

Signed-off-by: Chao Yu <yuchao0@huawei.com>
---
 fs/f2fs/compress.c | 2 +-
 fs/f2fs/data.c     | 6 +++++-
 fs/f2fs/f2fs.h     | 1 +
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
index 25d72e18ac30..d83dfbe624b0 100644
--- a/fs/f2fs/compress.c
+++ b/fs/f2fs/compress.c
@@ -88,7 +88,7 @@ static void f2fs_drop_rpages(struct compress_ctx *cc, int len, bool unlock)
 	}
 }
 
-static void f2fs_put_rpages(struct compress_ctx *cc)
+void f2fs_put_rpages(struct compress_ctx *cc)
 {
 	f2fs_drop_rpages(cc, cc->cluster_size, false);
 }
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 0a829a89f596..896887c9febe 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2115,7 +2115,7 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret,
 		} else if (!PageUptodate(page)) {
 			continue;
 		}
-		unlock_page(page);
+		f2fs_put_page(page, 1);
 		cc->rpages[i] = NULL;
 		cc->nr_rpages--;
 	}
@@ -2280,6 +2280,8 @@ int f2fs_mpage_readpages(struct address_space *mapping,
 							max_nr_pages,
 							&last_block_in_bio,
 							is_readahead, false);
+				if (ret)
+					f2fs_put_rpages(&cc);
 				f2fs_destroy_compress_ctx(&cc);
 				if (ret)
 					goto set_error_page;
@@ -2323,6 +2325,8 @@ int f2fs_mpage_readpages(struct address_space *mapping,
 							max_nr_pages,
 							&last_block_in_bio,
 							is_readahead, false);
+				if (ret)
+					f2fs_put_rpages(&cc);
 				f2fs_destroy_compress_ctx(&cc);
 			}
 		}
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index ed354af78966..25cc202adc50 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -3790,6 +3790,7 @@ static inline bool f2fs_post_read_required(struct inode *inode)
  */
 #ifdef CONFIG_F2FS_FS_COMPRESSION
 bool f2fs_is_compressed_page(struct page *page);
+void f2fs_put_rpages(struct compress_ctx *cc);
 struct page *f2fs_compress_control_page(struct page *page);
 int f2fs_prepare_compress_overwrite(struct inode *inode,
 			struct page **pagep, pgoff_t index, void **fsdata);
-- 
2.18.0.rc1



_______________________________________________
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

end of thread, other threads:[~2020-04-13  0:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-10 19:19 [f2fs-dev] [PATCH] f2fs: fix to avoid page count leak Markus Elfring
2020-04-13  0:34 ` Chao Yu
  -- strict thread matches above, loose matches on Subject: below --
2020-04-10  8:51 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).