All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gao Xiang <xiang@kernel.org>
To: Zhiguo Niu <zhiguo.niu@unisoc.com>
Cc: xiang@kernel.org, chao@kernel.org, niuzhiguo84@gmail.com,
	ke.wang@unisoc.com, zbestahu@gmail.com, jefflexu@163.com,
	dhavale@google.com, hongbohbli@tencent.com, guochunhai@vivo.com,
	linux-erofs@lists.ozlabs.org
Subject: Re: [PATCH] erofs: print error code in erofs_err() of erofs_readdir
Date: Fri, 27 Nov 2026 05:08:41 +0100	[thread overview]
Message-ID: <awkCSfgINQ3M3Cj-@MacBookPro.fritz.box> (raw)
In-Reply-To: <20261127025636.1333457-1-zhiguo.niu@unisoc.com>

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.

> -			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.

>  			break;
>  		}
>  
> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
> index e92a7fa90ae3..39f195e6d10b 100644
> --- a/fs/erofs/super.c
> +++ b/fs/erofs/super.c
> @@ -273,7 +273,7 @@ static int erofs_read_superblock(struct super_block *sb)
>  
>  	data = erofs_read_metabuf(&buf, sb, 0, false);
>  	if (IS_ERR(data)) {
> -		erofs_err(sb, "cannot read erofs superblock");
> +		erofs_err(sb, "cannot read erofs superblock: %ld", PTR_ERR(data));

same here.

Thanks,
Gao Xiang


  reply	other threads:[~2026-11-27  4:08 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 [this message]
2026-11-27  7:49   ` Zhiguo Niu
2026-11-30  2:05   ` Zhiguo Niu
2026-11-30 20:12     ` Gao Xiang
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=awkCSfgINQ3M3Cj-@MacBookPro.fritz.box \
    --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.