From: Gao Xiang <xiang@kernel.org>
To: Zhiguo Niu <niuzhiguo84@gmail.com>
Cc: xiang@kernel.org, chao@kernel.org, ke.wang@unisoc.com,
zbestahu@gmail.com, jefflexu@163.com, dhavale@google.com,
hongbohbli@tencent.com, guochunhai@vivo.com,
linux-erofs@lists.ozlabs.org, Zhiguo Niu <zhiguo.niu@unisoc.com>
Subject: Re: [PATCH] erofs: print error code in erofs_err() of erofs_readdir
Date: Mon, 30 Nov 2026 21:12:06 +0100 [thread overview]
Message-ID: <aw3YlvheWdv4aZhO@XiangdeMacBook-Pro.local> (raw)
In-Reply-To: <CAHJ8P3KSJDEhtMLjxv7fJYR83YrvJ7Vbq6UzqxyKemEeayKbKA@mail.gmail.com>
On Mon, Nov 30, 2026 at 10:05:05AM +0800, Zhiguo Niu wrote:
> Hi Xiang,
> Sorry, the contents of previous mail were a bit messy.
>
> Gao Xiang <xiang@kernel.org> 于2026年11月27日周五 12:08写道:
> >
> > Hi Zhiguo,
> >
> > On Fri, Nov 27, 2026 at 10:56:36AM +0800, Zhiguo Niu wrote:
> > > Under system stress tests, the following log frequently shows up:
> > > erofs: (device dm-8): erofs_readdir: failed to readdir of logical
> > > block 0 of nid 124
> > >
> > > Without the err value, it is hard to tell whether the failure was
> > > caused by an interrupted read (e.g. -EINTR) or a real I/O problem.
> > > Print the error code so that we can get more clues to the problem.
> > >
> > > Also fix the similar codes in other erofs_err() call sites where a
> > > real error code is available but not printed:
> > > - erofs_read_superblock: "cannot read erofs superblock"
> > > - z_erofs_init_pcpu_workers: per-cpu workers allocation and CPU
> > > hotplug init
> > > - z_erofs_readahead: "readahead error at folio ... @ nid ..."
> > >
> > > Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
> > > ---
> > > fs/erofs/dir.c | 4 ++--
> > > fs/erofs/super.c | 2 +-
> > > fs/erofs/zdata.c | 8 ++++----
> > > 3 files changed, 7 insertions(+), 7 deletions(-)
> > >
> > > diff --git a/fs/erofs/dir.c b/fs/erofs/dir.c
> > > index 4aa52a5f204a..69aea8a7c3dc 100644
> > > --- a/fs/erofs/dir.c
> > > +++ b/fs/erofs/dir.c
> > > @@ -83,9 +83,9 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx)
> > >
> > > de = erofs_bread(&buf, dbstart, true);
> > > if (IS_ERR(de)) {
> >
> > I guess the correct way is that we shouldn't error out -EINTR.
> OK
> >
> > > - erofs_err(sb, "failed to readdir of logical block %llu of nid %llu",
> > > - erofs_blknr(sb, dbstart), EROFS_I(dir)->nid);
> > > err = PTR_ERR(de);
> > > + erofs_err(sb, "failed to readdir of logical block %llu of nid %llu: %d",
> > > + erofs_blknr(sb, dbstart), EROFS_I(dir)->nid, err);
> >
> > you should just use %pe here directly.
>
> but for this point, and also considering the earlier suggestion to "should not
> error out -EINTR" ,this would be somewhat redundant; it might look
> something like this:
> if (IS_ERR(de)) {
> if (de != ERR_PTR(-EINTR))
> erofs_err(sb, "failed to readdir of logical block %llu of nid
> %llu: %pe" , erofs_blknr(sb, dbstart), EROFS_I(dir)->nid, de);
> err = PTR_ERR(de);
> break ;
> }
This one is actually better since it could print error codes
in the pretty form.
Could you send another version so I can apply soon?
Thanks,
Gao Xiang
next prev parent reply other threads:[~2026-11-30 20:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 2:56 [PATCH] erofs: print error code in erofs_err() of erofs_readdir Zhiguo Niu
2026-11-27 4:08 ` Gao Xiang
2026-11-27 7:49 ` Zhiguo Niu
2026-11-30 2:05 ` Zhiguo Niu
2026-11-30 20:12 ` Gao Xiang [this message]
2026-12-01 1:19 ` Zhiguo Niu
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=aw3YlvheWdv4aZhO@XiangdeMacBook-Pro.local \
--to=xiang@kernel.org \
--cc=chao@kernel.org \
--cc=dhavale@google.com \
--cc=guochunhai@vivo.com \
--cc=hongbohbli@tencent.com \
--cc=jefflexu@163.com \
--cc=ke.wang@unisoc.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=niuzhiguo84@gmail.com \
--cc=zbestahu@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.