From patchwork Sat Nov 7 12:13:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jamie Bainbridge X-Patchwork-Id: 7575491 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 34A369F1AF for ; Sat, 7 Nov 2015 12:14:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4359D20772 for ; Sat, 7 Nov 2015 12:14:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4BE8520771 for ; Sat, 7 Nov 2015 12:14:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751520AbbKGMOH (ORCPT ); Sat, 7 Nov 2015 07:14:07 -0500 Received: from mail-pa0-f48.google.com ([209.85.220.48]:34278 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751378AbbKGMOG (ORCPT ); Sat, 7 Nov 2015 07:14:06 -0500 Received: by padhx2 with SMTP id hx2so141700327pad.1 for ; Sat, 07 Nov 2015 04:14:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=a1vXSVW4uW9lkjYJA5cl0988VKLx3ZiYSAEEvz2ms1I=; b=C5mNkbbWGCq4W0h2ckvORRzNWNaBvox3CZKmj1gxl92Je9YTmp5UiJHB4MMH+volP4 Im6C1BtpwYC/9f7IeAT4/Eh/VPdXDJ4ZTRgI4BdvLrHFPPu5rWQotiRqmXiuc/7IxR+c HGRXYkA3NEED1az4JEs0F0qGSIznFofpgk8Uj3A2k0kSk0q7VPnNMlw1RzCOJxQg3eOq vRsBloXSgYD7Sz5QFT3JuPZ1N4PpV6WtlziqPLkkUp3Io627hSuyoT9JqdTlHIDzhkGD yfGkkjq9MDMieyDfEXXxfjtt8WmWjcEOoScXpv1eYGouD5Q9KIZ2SnWHcbkC+USfe0w6 +Ocg== X-Received: by 10.68.163.195 with SMTP id yk3mr24472710pbb.120.1446898445489; Sat, 07 Nov 2015 04:14:05 -0800 (PST) Received: from localhost.localdomain (182-239-202-17.ip.adam.com.au. [182.239.202.17]) by smtp.gmail.com with ESMTPSA id ix1sm5622324pbd.40.2015.11.07.04.14.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 07 Nov 2015 04:14:05 -0800 (PST) From: Jamie Bainbridge To: linux-cifs@vger.kernel.org Subject: [PATCH] cifs: Ratelimit kernel log messages Date: Sat, 7 Nov 2015 22:13:49 +1000 Message-Id: <7094bd3a2ef3c030463aa04fbce8369bfb33be9c.1446897962.git.jamie.bainbridge@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Under some conditions, CIFS can repeatedly call the cifs_dbg() logging wrapper. If done rapidly enough, the console framebuffer can softlockup or "rcu_sched self-detected stall". Apply the built-in log ratelimiters to prevent such hangs. Signed-off-by: Jamie Bainbridge --- fs/cifs/cifs_debug.c | 2 +- fs/cifs/cifs_debug.h | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c index 7febcf2475c5ab675c04dfd2fddaa3ed574522a0..50b268483302922ee63d205a2fa560ec27676eed 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c @@ -50,7 +50,7 @@ void cifs_vfs_err(const char *fmt, ...) vaf.fmt = fmt; vaf.va = &args; - pr_err("CIFS VFS: %pV", &vaf); + pr_err_ratelimited("CIFS VFS: %pV", &vaf); va_end(args); } diff --git a/fs/cifs/cifs_debug.h b/fs/cifs/cifs_debug.h index f40fbaca1b2a2c1d7457d71bd1a5e7dd4b477859..66cf0f9fff8984cb12eed1c89d91bc9c6ccc6a9d 100644 --- a/fs/cifs/cifs_debug.h +++ b/fs/cifs/cifs_debug.h @@ -51,14 +51,13 @@ __printf(1, 2) void cifs_vfs_err(const char *fmt, ...); /* information message: e.g., configuration, major event */ #define cifs_dbg(type, fmt, ...) \ do { \ - if (type == FYI) { \ - if (cifsFYI & CIFS_INFO) { \ - pr_debug("%s: " fmt, __FILE__, ##__VA_ARGS__); \ - } \ + if (type == FYI && cifsFYI & CIFS_INFO) { \ + pr_debug_ratelimited("%s: " \ + fmt, __FILE__, ##__VA_ARGS__); \ } else if (type == VFS) { \ cifs_vfs_err(fmt, ##__VA_ARGS__); \ } else if (type == NOISY && type != 0) { \ - pr_debug(fmt, ##__VA_ARGS__); \ + pr_debug_ratelimited(fmt, ##__VA_ARGS__); \ } \ } while (0)