* [PATCH v2] erofs: print error code in erofs_err() of erofs_readdir
@ 2026-12-01 1:53 Zhiguo Niu
2026-12-01 5:54 ` Gao Xiang
0 siblings, 1 reply; 2+ messages in thread
From: Zhiguo Niu @ 2026-12-01 1:53 UTC (permalink / raw)
To: xiang, chao
Cc: niuzhiguo84, zhiguo.niu, ke.wang, zbestahu, jefflexu, dhavale,
hongbohbli, guochunhai, linux-erofs
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>
---
v2: use %pe for print err pointer suggested by Xiang
---
fs/erofs/dir.c | 5 +++--
fs/erofs/super.c | 2 +-
fs/erofs/zdata.c | 8 ++++----
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/fs/erofs/dir.c b/fs/erofs/dir.c
index 4aa52a5f204a..a39489fe7df2 100644
--- a/fs/erofs/dir.c
+++ b/fs/erofs/dir.c
@@ -83,8 +83,9 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx)
de = erofs_bread(&buf, dbstart, true);
if (IS_ERR(de)) {
- erofs_err(sb, "failed to readdir of logical block %llu of nid %llu",
- erofs_blknr(sb, dbstart), EROFS_I(dir)->nid);
+ 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;
}
diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index e92a7fa90ae3..ce1191c83079 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: %pe", data);
return PTR_ERR(data);
}
diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
index e981e371d6c2..02a5342cec9d 100644
--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -416,13 +416,13 @@ static int z_erofs_init_pcpu_workers(struct super_block *sb)
err = erofs_init_percpu_workers();
if (err) {
- erofs_err(sb, "per-cpu workers: failed to allocate.");
+ erofs_err(sb, "per-cpu workers: failed to allocate: %d", err);
goto err_init_percpu_workers;
}
err = erofs_cpu_hotplug_init();
if (err < 0) {
- erofs_err(sb, "per-cpu workers: failed CPU hotplug init.");
+ erofs_err(sb, "per-cpu workers: failed CPU hotplug init: %d", err);
goto err_cpuhp_init;
}
erofs_info(sb, "initialized per-cpu workers successfully.");
@@ -1896,8 +1896,8 @@ static void z_erofs_readahead(struct readahead_control *rac)
while ((folio = readahead_folio_last(rac))) {
err = z_erofs_scan_folio(&f, folio, true);
if (err && err != -EINTR)
- erofs_err(realinode->i_sb, "readahead error at folio %lu @ nid %llu",
- folio->index, EROFS_I(realinode)->nid);
+ erofs_err(realinode->i_sb, "readahead error at folio %lu @ nid %llu: %d",
+ folio->index, EROFS_I(realinode)->nid, err);
}
z_erofs_pcluster_readmore(&f, rac, false);
z_erofs_pcluster_end(&f);
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] erofs: print error code in erofs_err() of erofs_readdir
2026-12-01 1:53 [PATCH v2] erofs: print error code in erofs_err() of erofs_readdir Zhiguo Niu
@ 2026-12-01 5:54 ` Gao Xiang
0 siblings, 0 replies; 2+ messages in thread
From: Gao Xiang @ 2026-12-01 5:54 UTC (permalink / raw)
To: Zhiguo Niu
Cc: xiang, chao, niuzhiguo84, ke.wang, zbestahu, jefflexu, dhavale,
hongbohbli, guochunhai, linux-erofs
On Tue, Dec 01, 2026 at 09:53:07AM +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>
Reviewed-by: Gao Xiang <xiang@kernel.org>
Thanks,
Gao Xiang
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-01 5:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 1:53 [PATCH v2] erofs: print error code in erofs_err() of erofs_readdir Zhiguo Niu
2026-12-01 5:54 ` Gao Xiang
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.