From: Li Chen Date: Mon, 17 Nov 2025 05:34:07 +0000 (+0800) Subject: block: rate-limit capacity change info log X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3179a5f7f86bcc3acd5d6fb2a29f891ef5615852;p=thirdparty%2Flinux.git block: rate-limit capacity change info log loop devices under heavy stress-ng loop streessor can trigger many capacity change events in a short time. Each event prints an info message from set_capacity_and_notify(), flooding the console and contributing to soft lockups on slow consoles. Switch the printk in set_capacity_and_notify() to pr_info_ratelimited() so frequent capacity changes do not spam the log while still reporting occasional changes. Cc: stable@vger.kernel.org Signed-off-by: Li Chen Reviewed-by: Chaitanya Kulkarni Reviewed-by: Bart Van Assche Signed-off-by: Jens Axboe --- diff --git a/block/genhd.c b/block/genhd.c index 9bbc38d127926..bd3a6841e5b59 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -90,7 +90,7 @@ bool set_capacity_and_notify(struct gendisk *disk, sector_t size) (disk->flags & GENHD_FL_HIDDEN)) return false; - pr_info("%s: detected capacity change from %lld to %lld\n", + pr_info_ratelimited("%s: detected capacity change from %lld to %lld\n", disk->disk_name, capacity, size); /*