Skip to contentSkip to conversation

reduce dmesg spam

PATCH In review Christoph Hellwig 2 participants 4 messages Feb 20, 2020 XFS filesystem

lore
Share & tools
lore
#0 lore raw

Hi all,

When a device keeps failing I/O (for example using dm-flakey in various tests), we keep spamming the log for each I/O error, although the messages are very much duplicates. Use printk_ratelimit() to reduce the number of logged lines.

#1 lore raw

PATCH 1/2 xfs: ratelimit xfs_buf_ioerror_alert

Use printk_ratelimit() to limit the amount of messages printed from xfs_buf_ioerror_alert. Without that a failing device causes a large number of errors that doesn't really help debugging the underling issue.

---
 fs/xfs/xfs_buf.c | 2 ++
 1 file changed, 2 insertions(+)
fs/xfs/xfs_buf.c +2 -0
index 217e4f82a44a..e010680a665e 100644
@@ -1238,6 +1238,8 @@ xfs_buf_ioerror_alert(
 	struct xfs_buf		*bp,
 	xfs_failaddr_t		func)
 {
+	if (!printk_ratelimit())
+		return;
 	xfs_alert(bp->b_mount,
 "metadata I/O error in \"%pS\" at daddr 0x%llx len %d error %d",
 			func, (uint64_t)XFS_BUF_ADDR(bp), bp->b_length,
Signature · 1 line
2.24.1
#2 lore raw

Re: [PATCH 1/2] xfs: ratelimit xfs_buf_ioerror_alert

Quoted 15 lines · Christoph Hellwig

Use printk_ratelimit() to limit the amount of messages printed from xfs_buf_ioerror_alert. Without that a failing device causes a large number of errors that doesn't really help debugging the underling issue.

---
 fs/xfs/xfs_buf.c | 2 ++
 1 file changed, 2 insertions(+)
fs/xfs/xfs_buf.c +0 -0
index 217e4f82a44a..e010680a665e 100644

fs/xfs/xfs_buf.c xfs_buf_ioerror_alert( · line 1242

Quoted 5 lines
fs/xfs/xfs_buf.c +2 -0
@@ -1238,6 +1238,8 @@ xfs_buf_ioerror_alert(
 	struct xfs_buf		*bp,
 	xfs_failaddr_t		func)
 {
+	if (!printk_ratelimit())
+		return;

xfs_alert_ratelimited() ?

Brian

Quoted 6 lines
fs/xfs/xfs_buf.c +0 -0
 	xfs_alert(bp->b_mount,
 "metadata I/O error in \"%pS\" at daddr 0x%llx len %d error %d",
 			func, (uint64_t)XFS_BUF_ADDR(bp), bp->b_length,
Signature · 1 line
2.24.1
#3 lore raw

PATCH 2/2 xfs: ratelimit xfs_discard_page alert messages

In reply to Christoph Hellwig

Use printk_ratelimit() to limit the amount of messages printed from xfs_discard_page. Without that a failing device causes a large number of errors that doesn't really help debugging the underling issue.

---
 fs/xfs/xfs_aops.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
fs/xfs/xfs_aops.c +4 -3
index 58e937be24ce..acdda808fbdd 100644
@@ -539,9 +539,10 @@ xfs_discard_page(
 	if (XFS_FORCED_SHUTDOWN(mp))
 		goto out_invalidate;
 
-	xfs_alert(mp,
-		"page discard on page "PTR_FMT", inode 0x%llx, offset %llu.",
-			page, ip->i_ino, offset);
+	if (printk_ratelimit())
+		xfs_alert(mp,
+			"page discard on page "PTR_FMT", inode 0x%llx, offset %llu.",
+				page, ip->i_ino, offset);
 
 	error = xfs_bmap_punch_delalloc_range(ip, start_fsb,
 			PAGE_SIZE / i_blocksize(inode));
Signature · 1 line
2.24.1