Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1393733

[PATCH 10/11] f2fs: fix leak of orphan inode objects

From Jaegeuk Kim <jaegeuk@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 10/11] f2fs: fix leak of orphan inode objects
Date 2016-05-03 20:30 +0200
Message-ID <ruNf5-4Gi-49@gated-at.bofh.it> (permalink)
References <ruNf3-4Gi-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


When unmounting filesystem, we should release all the ino entries.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/checkpoint.c | 6 +++---
 fs/f2fs/f2fs.h       | 2 +-
 fs/f2fs/super.c      | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 9169dab..6402e93 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -449,12 +449,12 @@ bool exist_written_data(struct f2fs_sb_info *sbi, nid_t ino, int mode)
 	return e ? true : false;
 }
 
-void release_ino_entry(struct f2fs_sb_info *sbi)
+void release_ino_entry(struct f2fs_sb_info *sbi, bool all)
 {
 	struct ino_entry *e, *tmp;
 	int i;
 
-	for (i = APPEND_INO; i <= UPDATE_INO; i++) {
+	for (i = all ? ORPHAN_INO: APPEND_INO; i <= UPDATE_INO; i++) {
 		struct inode_management *im = &sbi->im[i];
 
 		spin_lock(&im->ino_lock);
@@ -1090,7 +1090,7 @@ static int do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 		invalidate_mapping_pages(META_MAPPING(sbi), discard_blk,
 								discard_blk);
 
-	release_ino_entry(sbi);
+	release_ino_entry(sbi, false);
 
 	if (unlikely(f2fs_cp_error(sbi)))
 		return -EIO;
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 659fdea..6e6fd0b 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1910,7 +1910,7 @@ void ra_meta_pages_cond(struct f2fs_sb_info *, pgoff_t);
 long sync_meta_pages(struct f2fs_sb_info *, enum page_type, long);
 void add_ino_entry(struct f2fs_sb_info *, nid_t, int type);
 void remove_ino_entry(struct f2fs_sb_info *, nid_t, int type);
-void release_ino_entry(struct f2fs_sb_info *);
+void release_ino_entry(struct f2fs_sb_info *, bool);
 bool exist_written_data(struct f2fs_sb_info *, nid_t, int);
 int acquire_orphan_inode(struct f2fs_sb_info *);
 void release_orphan_inode(struct f2fs_sb_info *);
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 55e8eb0..6b5f0af 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -596,7 +596,7 @@ static void f2fs_put_super(struct super_block *sb)
 	 * normally superblock is clean, so we need to release this.
 	 * In addition, EIO will skip do checkpoint, we need this as well.
 	 */
-	release_ino_entry(sbi);
+	release_ino_entry(sbi, true);
 	release_discard_addrs(sbi);
 
 	f2fs_leave_shrinker(sbi);
-- 
2.6.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 01/11] f2fs: introduce macros for proc entries Jaegeuk Kim <jaegeuk@kernel.org> - 2016-05-03 20:30 +0200
  [PATCH 04/11] f2fs: use f2fs_grab_cache_page instead of grab_cache_page Jaegeuk Kim <jaegeuk@kernel.org> - 2016-05-03 20:30 +0200
  [PATCH 10/11] f2fs: fix leak of orphan inode objects Jaegeuk Kim <jaegeuk@kernel.org> - 2016-05-03 20:30 +0200
  [PATCH 07/11] f2fs: inject page allocation failures Jaegeuk Kim <jaegeuk@kernel.org> - 2016-05-03 20:30 +0200
  [PATCH 09/11] f2fs: revisit error handling flows Jaegeuk Kim <jaegeuk@kernel.org> - 2016-05-03 20:30 +0200
  [PATCH 11/11] f2fs: retry to truncate blocks in -ENOMEM case Jaegeuk Kim <jaegeuk@kernel.org> - 2016-05-03 20:30 +0200
    Re: [f2fs-dev] [PATCH 11/11] f2fs: retry to truncate blocks in -ENOMEM  case Hou Pengyang <houpengyang@huawei.com> - 2016-05-05 04:10 +0200
      Re: [f2fs-dev] [PATCH 11/11] f2fs: retry to truncate blocks in  -ENOMEM case Jaegeuk Kim <jaegeuk@kernel.org> - 2016-05-05 05:00 +0200

csiph-web