Skip to content

Commit c83414a

Browse files
chaseyuJaegeuk Kim
authored and
Jaegeuk Kim
committed
f2fs: set SBI_NEED_FSCK for xattr corruption case
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]>
1 parent 10f966b commit c83414a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fs/f2fs/xattr.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,9 @@ static int lookup_all_xattrs(struct inode *inode, struct page *ipage,
346346

347347
*xe = __find_xattr(cur_addr, last_txattr_addr, index, len, name);
348348
if (!*xe) {
349+
f2fs_err(F2FS_I_SB(inode), "inode (%lu) has corrupted xattr",
350+
inode->i_ino);
351+
set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK);
349352
err = -EFSCORRUPTED;
350353
goto out;
351354
}
@@ -622,6 +625,9 @@ static int __f2fs_setxattr(struct inode *inode, int index,
622625
/* find entry with wanted name. */
623626
here = __find_xattr(base_addr, last_base_addr, index, len, name);
624627
if (!here) {
628+
f2fs_err(F2FS_I_SB(inode), "inode (%lu) has corrupted xattr",
629+
inode->i_ino);
630+
set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_FSCK);
625631
error = -EFSCORRUPTED;
626632
goto exit;
627633
}

0 commit comments

Comments
 (0)