From: Chao Yu <chao@kernel.org>
To: Zhiguo Niu <zhiguo.niu@unisoc.com>, jaegeuk@kernel.org
Cc: ke.wang@unisoc.com, niuzhiguo84@gmail.com,
linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: fix to check return value of f2fs_recover_xattr_data
Date: Tue, 12 Dec 2023 09:39:00 +0800 [thread overview]
Message-ID: <3478e715-3fe2-4686-aa9d-8fa2f4083dac@kernel.org> (raw)
In-Reply-To: <1702025433-5860-1-git-send-email-zhiguo.niu@unisoc.com>
On 2023/12/8 16:50, Zhiguo Niu wrote:
> 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: 50a472bbc79f ("f2fs: do not return EFSCORRUPTED, but try to run online repair")
> Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
> ---
> fs/f2fs/node.c | 6 +++---
> fs/f2fs/xattr.c | 12 +++++++-----
> 2 files changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index e50a093..93bf724 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -2754,11 +2754,11 @@ int f2fs_recover_xattr_data(struct inode *inode, struct page *page)
> f2fs_update_inode_page(inode);
>
> /* 3: update and set xattr node page dirty */
> - if (page)
> + if (page) {
> memcpy(F2FS_NODE(xpage), F2FS_NODE(page),
> VALID_XATTR_BLOCK_SIZE);
> -
> - set_page_dirty(xpage);
> + set_page_dirty(xpage);
> + }
> f2fs_put_page(xpage, 1);
>
> return 0;
> diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
> index 47e88b4..de92891 100644
> --- a/fs/f2fs/xattr.c
> +++ b/fs/f2fs/xattr.c
> @@ -660,11 +660,13 @@ static int __f2fs_setxattr(struct inode *inode, int index,
> here = __find_xattr(base_addr, last_base_addr, NULL, index, len, name);
> if (!here) {
> if (!F2FS_I(inode)->i_xattr_nid) {
> - f2fs_notice(F2FS_I_SB(inode),
> - "recover xattr in inode (%lu)", inode->i_ino);
> - f2fs_recover_xattr_data(inode, NULL);
> - kfree(base_addr);
> - goto retry;
> + error = f2fs_recover_xattr_data(inode, NULL);
How about printing here?
f2fs_notice(F2FS_I_SB(inode),
"recover xattr in inode (%lu), error: %d", inode->i_ino, error);
Thanks,
> + if (!error) {
> + f2fs_notice(F2FS_I_SB(inode),
> + "recover xattr in inode (%lu)", inode->i_ino);
> + kfree(base_addr);
> + goto retry;
> + }
> }
> f2fs_err(F2FS_I_SB(inode), "set inode (%lu) has corrupted xattr",
> inode->i_ino);
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
prev parent reply other threads:[~2023-12-12 1:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-08 8:50 [f2fs-dev] [PATCH] f2fs: fix to check return value of f2fs_recover_xattr_data Zhiguo Niu
2023-12-12 1:39 ` Chao Yu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3478e715-3fe2-4686-aa9d-8fa2f4083dac@kernel.org \
--to=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=ke.wang@unisoc.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=niuzhiguo84@gmail.com \
--cc=zhiguo.niu@unisoc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).