lkml.org 
[lkml]   [2017]   [Oct]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] f2fs: fix out-of-free problem caused by atomic write
Date
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
\
 
 \ /
  Last update: 2017-10-26 16:22    [W:0.056 / U:45.100 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site