All of lore.kernel.org
 help / color / mirror / Atom feed
From: <lduncan@suse.com>
To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Lee Duncan <lduncan@suse.com>
Subject: [PATCH] Fix fnic driver to remove bogus ratelimit messages.
Date: Tue, 23 Mar 2021 10:27:56 -0700	[thread overview]
Message-ID: <20210323172756.5743-1-lduncan@suse.com> (raw)

From: Lee Duncan <lduncan@suse.com>

Commit b43abcbbd5b1 ("scsi: fnic: Ratelimit printks to avoid
looding when vlan is not set by the switch.i") added
printk_ratelimit() in front of a couple of debug-mode
messages, to reduce logging overrun when debugging the
driver. The code:

>           if (printk_ratelimit())
>                   FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host,
>                             "Start VLAN Discovery\n");

ends up calling printk_ratelimit() quite often, triggering
many kernel messages about callbacks being surpressed.

The fix is to decompose FNIC_FCS_DBG(), then change the order
of checks so that printk_ratelimit() is only called if
driver debugging is enabled.

Signed-off-by: Lee Duncan <lduncan@suse.com>
---
 drivers/scsi/fnic/fnic_fcs.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_fcs.c b/drivers/scsi/fnic/fnic_fcs.c
index e0cee4dcb439..332b31493e79 100644
--- a/drivers/scsi/fnic/fnic_fcs.c
+++ b/drivers/scsi/fnic/fnic_fcs.c
@@ -1343,9 +1343,10 @@ void fnic_handle_fip_timer(struct fnic *fnic)
 	if (list_empty(&fnic->vlans)) {
 		spin_unlock_irqrestore(&fnic->vlans_lock, flags);
 		/* no vlans available, try again */
-		if (printk_ratelimit())
-			FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host,
-				  "Start VLAN Discovery\n");
+		if (unlikely(fnic_log_level & FNIC_FCS_LOGGING))
+			if (printk_ratelimit())
+				shost_printk(KERN_DEBUG, fnic->lport->host,
+						"Start VLAN Discovery\n");
 		fnic_event_enq(fnic, FNIC_EVT_START_VLAN_DISC);
 		return;
 	}
@@ -1363,9 +1364,10 @@ void fnic_handle_fip_timer(struct fnic *fnic)
 	case FIP_VLAN_FAILED:
 		spin_unlock_irqrestore(&fnic->vlans_lock, flags);
 		/* if all vlans are in failed state, restart vlan disc */
-		if (printk_ratelimit())
-			FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host,
-				  "Start VLAN Discovery\n");
+		if (unlikely(fnic_log_level & FNIC_FCS_LOGGING))
+			if (printk_ratelimit())
+				shost_printk(KERN_DEBUG, fnic->lport->host,
+					  "Start VLAN Discovery\n");
 		fnic_event_enq(fnic, FNIC_EVT_START_VLAN_DISC);
 		break;
 	case FIP_VLAN_SENT:
-- 
2.30.2


             reply	other threads:[~2021-03-23 17:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23 17:27 lduncan [this message]
2021-03-23 18:31 ` [PATCH] Fix fnic driver to remove bogus ratelimit messages Laurence Oberman
2021-03-24 22:41 ` Joe Perches
2021-03-25 15:51   ` Lee Duncan
2021-03-29 18:33   ` Lee Duncan
2021-03-30  2:46 ` Martin K. Petersen
2021-04-02  3:54 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210323172756.5743-1-lduncan@suse.com \
    --to=lduncan@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.