From: Yunlei He <heyunlei@huawei.com>
To: jaegeuk@kernel.org, yuchao0@huawei.com,
linux-f2fs-devel@lists.sourceforge.net
Cc: heyunlei@huawei.com
Subject: [PATCH] f2fs: add bug on back during flush nat entries
Date: Mon, 12 Feb 2018 11:42:34 +0800 [thread overview]
Message-ID: <1518406954-29047-1-git-send-email-heyunlei@huawei.com> (raw)
This patch add two bug on check back during flush nat entries,
nat_tree_lock will prevent race from node block allocation
in write_begin.
Signed-off-by: Yunlei He <heyunlei@huawei.com>
---
fs/f2fs/node.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 833b46b..ced986d 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -2519,10 +2519,9 @@ static void __flush_nat_entry_set(struct f2fs_sb_info *sbi,
}
/* Allow dirty nats by node block allocation in write_begin */
- if (!set->entry_cnt) {
- radix_tree_delete(&NM_I(sbi)->nat_set_root, set->set);
- kmem_cache_free(nat_entry_set_slab, set);
- }
+ f2fs_bug_on(sbi, set->entry_cnt);
+ radix_tree_delete(&NM_I(sbi)->nat_set_root, set->set);
+ kmem_cache_free(nat_entry_set_slab, set);
}
/*
@@ -2566,8 +2565,8 @@ void flush_nat_entries(struct f2fs_sb_info *sbi, struct cp_control *cpc)
list_for_each_entry_safe(set, tmp, &sets, set_list)
__flush_nat_entry_set(sbi, set, cpc);
+ f2fs_bug_on(sbi, nm_i->dirty_nat_cnt);
up_write(&nm_i->nat_tree_lock);
- /* Allow dirty nats by node block allocation in write_begin */
}
static int __get_nat_bitmaps(struct f2fs_sb_info *sbi)
--
1.9.1
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
next reply other threads:[~2018-02-12 3:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-12 3:42 Yunlei He [this message]
2018-02-13 10:04 ` [PATCH] f2fs: add bug on back during flush nat entries Chao Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1518406954-29047-1-git-send-email-heyunlei@huawei.com \
--to=heyunlei@huawei.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=yuchao0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).