Skip to content

Commit

Permalink
f2fs: set SBI_NEED_FSCK for xattr corruption case
Browse files Browse the repository at this point in the history
If xattr is corrupted, let's print kernel message and set SBI_NEED_FSCK
for further repair.

Reported-by: Pavel Machek <[email protected]>
Signed-off-by: Chao Yu <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
  • Loading branch information
chaseyu authored and Jaegeuk Kim committed Jul 13, 2019
1 parent ef51c64 commit 903a2cf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fs/f2fs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ static int lookup_all_xattrs(struct inode *inode, struct page *ipage,

*xe = __find_xattr(cur_addr, last_txattr_addr, index, len, name);
if (!*xe) {
f2fs_err(F2FS_I_SB(inode), "inode (%lu) has corrupted xattr",
inode->i_ino);
set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK);
err = -EFSCORRUPTED;
goto out;
}
Expand Down Expand Up @@ -663,6 +666,9 @@ static int __f2fs_setxattr(struct inode *inode, int index,
/* find entry with wanted name. */
here = __find_xattr(base_addr, last_base_addr, index, len, name);
if (!here) {
f2fs_err(F2FS_I_SB(inode), "inode (%lu) has corrupted xattr",
inode->i_ino);
set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK);
error = -EFSCORRUPTED;
goto exit;
}
Expand Down

0 comments on commit 903a2cf

Please sign in to comment.