diff options
author | Chao Yu <yuchao0@huawei.com> | 2017-01-07 13:52:01 +0300 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2017-02-23 05:48:49 +0300 |
commit | 599a09b2c1ac222e6aad0c22515d1ccde7c3b702 (patch) | |
tree | 55d398c8c0c971edf8f31e7be9d811e93b199801 /fs/f2fs/node.c | |
parent | 355e78913c0d57492076d545b6f44b94fec2bf6b (diff) | |
download | linux-599a09b2c1ac222e6aad0c22515d1ccde7c3b702.tar.xz |
f2fs: check in-memory nat version bitmap
This patch adds a mirror for nat version bitmap, and use it to detect
in-memory bitmap corruption which may be caused by bit-transition of
cache or memory overflow.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/node.c')
-rw-r--r-- | fs/f2fs/node.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 03a1f9043558..69c38a0022e7 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -2363,6 +2363,14 @@ static int init_node_manager(struct f2fs_sb_info *sbi) GFP_KERNEL); if (!nm_i->nat_bitmap) return -ENOMEM; + +#ifdef CONFIG_F2FS_CHECK_FS + nm_i->nat_bitmap_mir = kmemdup(version_bitmap, nm_i->bitmap_size, + GFP_KERNEL); + if (!nm_i->nat_bitmap_mir) + return -ENOMEM; +#endif + return 0; } @@ -2437,6 +2445,9 @@ void destroy_node_manager(struct f2fs_sb_info *sbi) up_write(&nm_i->nat_tree_lock); kfree(nm_i->nat_bitmap); +#ifdef CONFIG_F2FS_CHECK_FS + kfree(nm_i->nat_bitmap_mir); +#endif sbi->nm_info = NULL; kfree(nm_i); } |