Skip to contentSkip to conversation

erofs: avoid noisy messages for transient -ENOMEM

PATCH In review Gao Xiang 2 participants 2 messages Dec 26, 2025 – Jan 22 EROFS file system

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs: avoid noisy messages for transient -ENOMEM

EROFS may allocate temporary pages using GFP_NOWAIT | GFP_NORETRY when pcl->besteffort is off (e.g., for readahead requests).

If the allocation fails, the original request will fall back to synchronous read, so the failure is transient.

Such fallback can frequently happen in low memory scenarios, but since these failures are expected and temporary, avoid printing error messages like below:

[ 7425.184264] erofs (device sr0): failed to decompress (lz4) -ENOMEM @ pa 148447232 size 28672 => 26788
[ 7426.244267] erofs (device sr0): failed to decompress (lz4) -ENOMEM @ pa 149422080 size 28672 => 15903
[ 7426.245508] erofs (device sr0): failed to decompress (lz4) -ENOMEM @ pa 138440704 size 28672 => 39294
...
[ 7504.258373] erofs (device sr0): failed to decompress (lz4) -ENOMEM @ pa 93581312 size 20480 => 47366
Fixes 831faabed812 ("erofs: improve decompression error reporting")
---
 fs/erofs/zdata.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
fs/erofs/zdata.c +4 -3
index 3d31f7840ca0..bc2e0d3b97dd 100644
@@ -1324,9 +1324,10 @@ static int z_erofs_decompress_pcluster(struct z_erofs_backend *be, bool eio)
 						GFP_NOWAIT | __GFP_NORETRY
 				 }, be->pagepool);
 		if (IS_ERR(reason)) {
-			erofs_err(be->sb, "failed to decompress (%s) %ld @ pa %llu size %u => %u",
-				  alg->name, PTR_ERR(reason), pcl->pos,
-				  pcl->pclustersize, pcl->length);
+			if (pcl->besteffort || reason != ERR_PTR(-ENOMEM))
+				erofs_err(be->sb, "failed to decompress (%s) %ld @ pa %llu size %u => %u",
+					  alg->name, PTR_ERR(reason), pcl->pos,
+					  pcl->pclustersize, pcl->length);
 			err = PTR_ERR(reason);
 		} else if (unlikely(reason)) {
 			erofs_err(be->sb, "failed to decompress (%s) %s @ pa %llu size %u => %u",
Signature · 1 line
2.43.5
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Gao Xiang

EROFS may allocate temporary pages using GFP_NOWAIT | GFP_NORETRY when pcl->besteffort is off (e.g., for readahead requests).

If the allocation fails, the original request will fall back to synchronous read, so the failure is transient.

Such fallback can frequently happen in low memory scenarios, but since these failures are expected and temporary, avoid printing error messages like below:

Quoted 8 lines
[ 7425.184264] erofs (device sr0): failed to decompress (lz4) -ENOMEM @ pa 148447232 size 28672 => 26788
[ 7426.244267] erofs (device sr0): failed to decompress (lz4) -ENOMEM @ pa 149422080 size 28672 => 15903
[ 7426.245508] erofs (device sr0): failed to decompress (lz4) -ENOMEM @ pa 138440704 size 28672 => 39294
...
[ 7504.258373] erofs (device sr0): failed to decompress (lz4) -ENOMEM @ pa 93581312 size 20480 => 47366
Fixes 831faabed812 ("erofs: improve decompression error reporting")

Thanks,