]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.11.2/revert-f2fs-put-allocate_segment-after-refresh_sit_entry.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.11.2 / revert-f2fs-put-allocate_segment-after-refresh_sit_entry.patch
1 From c6f82fe90d7458e5fa190a6820bfc24f96b0de4e Mon Sep 17 00:00:00 2001
2 From: Jaegeuk Kim <jaegeuk@kernel.org>
3 Date: Tue, 4 Apr 2017 16:45:30 -0700
4 Subject: Revert "f2fs: put allocate_segment after refresh_sit_entry"
5
6 From: Jaegeuk Kim <jaegeuk@kernel.org>
7
8 commit c6f82fe90d7458e5fa190a6820bfc24f96b0de4e upstream.
9
10 This reverts commit 3436c4bdb30de421d46f58c9174669fbcfd40ce0.
11
12 This makes a leak to register dirty segments. I reproduced the issue by
13 modified postmark which injects a lot of file create/delete/update and
14 finally triggers huge number of SSR allocations.
15
16 [Jaegeuk Kim: Change missing incorrect comment]
17 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19
20 ---
21 fs/f2fs/segment.c | 9 ++++-----
22 1 file changed, 4 insertions(+), 5 deletions(-)
23
24 --- a/fs/f2fs/segment.c
25 +++ b/fs/f2fs/segment.c
26 @@ -1788,15 +1788,14 @@ void allocate_data_block(struct f2fs_sb_
27
28 stat_inc_block_count(sbi, curseg);
29
30 + if (!__has_curseg_space(sbi, type))
31 + sit_i->s_ops->allocate_segment(sbi, type, false);
32 /*
33 - * SIT information should be updated before segment allocation,
34 - * since SSR needs latest valid block information.
35 + * SIT information should be updated after segment allocation,
36 + * since we need to keep dirty segments precisely under SSR.
37 */
38 refresh_sit_entry(sbi, old_blkaddr, *new_blkaddr);
39
40 - if (!__has_curseg_space(sbi, type))
41 - sit_i->s_ops->allocate_segment(sbi, type, false);
42 -
43 mutex_unlock(&sit_i->sentry_lock);
44
45 if (page && IS_NODESEG(type))