linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: fix out-of-free problem caused by atomic write
@ 2017-10-26 14:21 Yunlong Song
  2017-10-26 14:30 ` Jaegeuk Kim
  2017-10-30 13:04 ` [PATCH v2] " Yunlong Song
  0 siblings, 2 replies; 11+ messages in thread
From: Yunlong Song @ 2017-10-26 14:21 UTC (permalink / raw)
  To: jaegeuk, chao, yuchao0, yunlong.song, yunlong.song
  Cc: miaoxie, bintian.wang, linux-fsdevel, linux-f2fs-devel,
	linux-kernel

f2fs_balance_fs only actives once in the commit_inmem_pages, but there
are more than one page to commit, so all the other pages will miss the
check. This will lead to out-of-free problem when commit a very large
file. To fix it, we should do f2fs_balance_fs for each inmem page.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
---
 fs/f2fs/segment.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 46dfbca..fa2c36b 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -384,6 +384,9 @@ static int __commit_inmem_pages(struct inode *inode,
 				unlock_page(page);
 				break;
 			}
+			f2fs_unlock_op(sbi);
+			f2fs_balance_fs(sbi, true);
+			f2fs_lock_op(sbi);
 			/* record old blkaddr for revoking */
 			cur->old_addr = fio.old_blkaddr;
 			last_idx = page->index;
@@ -409,7 +412,6 @@ int commit_inmem_pages(struct inode *inode)
 	int err;
 
 	INIT_LIST_HEAD(&revoke_list);
-	f2fs_balance_fs(sbi, true);
 	f2fs_lock_op(sbi);
 
 	set_inode_flag(inode, FI_ATOMIC_COMMIT);
-- 
1.8.5.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-11-06  1:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-26 14:21 [PATCH] f2fs: fix out-of-free problem caused by atomic write Yunlong Song
2017-10-26 14:30 ` Jaegeuk Kim
2017-10-27  6:38   ` Christoph Hellwig
2017-10-27 11:23     ` Jaegeuk Kim
2017-10-30 13:04 ` [PATCH v2] " Yunlong Song
2017-11-03  3:27   ` Yunlong Song
2017-11-03  3:46   ` Jaegeuk Kim
2017-11-03  4:48     ` Yunlong Song
2017-11-03 14:40       ` Yunlong Song
2017-11-03 15:23         ` Chao Yu
2017-11-06  1:34           ` Yunlong Song

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).