Skip to content

Commit 86d7d57

Browse files
Zhiguo NiuJaegeuk Kim
authored andcommitted
f2fs: fix to check return value of f2fs_recover_xattr_data
Should check return value of f2fs_recover_xattr_data in __f2fs_setxattr rather than doing invalid retry if error happen. Also just do set_page_dirty in f2fs_recover_xattr_data when page is changed really. Fixes: 50a472b ("f2fs: do not return EFSCORRUPTED, but try to run online repair") Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 394e7f4 commit 86d7d57

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

fs/f2fs/node.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2751,11 +2751,11 @@ int f2fs_recover_xattr_data(struct inode *inode, struct page *page)
27512751
f2fs_update_inode_page(inode);
27522752

27532753
/* 3: update and set xattr node page dirty */
2754-
if (page)
2754+
if (page) {
27552755
memcpy(F2FS_NODE(xpage), F2FS_NODE(page),
27562756
VALID_XATTR_BLOCK_SIZE);
2757-
2758-
set_page_dirty(xpage);
2757+
set_page_dirty(xpage);
2758+
}
27592759
f2fs_put_page(xpage, 1);
27602760

27612761
return 0;

fs/f2fs/xattr.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -660,11 +660,14 @@ static int __f2fs_setxattr(struct inode *inode, int index,
660660
here = __find_xattr(base_addr, last_base_addr, NULL, index, len, name);
661661
if (!here) {
662662
if (!F2FS_I(inode)->i_xattr_nid) {
663+
error = f2fs_recover_xattr_data(inode, NULL);
663664
f2fs_notice(F2FS_I_SB(inode),
664-
"recover xattr in inode (%lu)", inode->i_ino);
665-
f2fs_recover_xattr_data(inode, NULL);
666-
kfree(base_addr);
667-
goto retry;
665+
"recover xattr in inode (%lu), error(%d)",
666+
inode->i_ino, error);
667+
if (!error) {
668+
kfree(base_addr);
669+
goto retry;
670+
}
668671
}
669672
f2fs_err(F2FS_I_SB(inode), "set inode (%lu) has corrupted xattr",
670673
inode->i_ino);

0 commit comments

Comments
 (0)