mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
f2fs: Add sanity_check_inode() function
This was done as part of commits5d64600d4f"f2fs: avoid bug_on on corrupted inode" and76d56d4ab4"f2fs: fix to do sanity check with extra_attr feature" upstream, but the specific checks they added are not applicable to 4.9. Cc: Jaegeuk Kim <jaegeuk@kernel.org> Cc: Chao Yu <yuchao0@huawei.com> Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
06e606aced
commit
fd8c7d35bd
@@ -104,6 +104,13 @@ static void __recover_inline_status(struct inode *inode, struct page *ipage)
|
||||
return;
|
||||
}
|
||||
|
||||
static bool sanity_check_inode(struct inode *inode)
|
||||
{
|
||||
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int do_read_inode(struct inode *inode)
|
||||
{
|
||||
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
|
||||
@@ -153,6 +160,11 @@ static int do_read_inode(struct inode *inode)
|
||||
|
||||
get_inline_info(inode, ri);
|
||||
|
||||
if (!sanity_check_inode(inode)) {
|
||||
f2fs_put_page(node_page, 1);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* check data exist */
|
||||
if (f2fs_has_inline_data(inode) && !f2fs_exist_data(inode))
|
||||
__recover_inline_status(inode, node_page);
|
||||
|
||||
Reference in New Issue
Block a user