Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: fnic: Remove bogus ratelimit messages

Commit b43abcbbd5b1 ("scsi: fnic: Ratelimit printks to avoid flooding 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 supressed.

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.

Link: https://lore.kernel.org/r/20210323172756.5743-1-lduncan@suse.com
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Signed-off-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Lee Duncan and committed by
Martin K. Petersen
d2478dd2 10d91a15

+8 -6
+8 -6
drivers/scsi/fnic/fnic_fcs.c
··· 1343 1343 if (list_empty(&fnic->vlans)) { 1344 1344 spin_unlock_irqrestore(&fnic->vlans_lock, flags); 1345 1345 /* no vlans available, try again */ 1346 - if (printk_ratelimit()) 1347 - FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, 1348 - "Start VLAN Discovery\n"); 1346 + if (unlikely(fnic_log_level & FNIC_FCS_LOGGING)) 1347 + if (printk_ratelimit()) 1348 + shost_printk(KERN_DEBUG, fnic->lport->host, 1349 + "Start VLAN Discovery\n"); 1349 1350 fnic_event_enq(fnic, FNIC_EVT_START_VLAN_DISC); 1350 1351 return; 1351 1352 } ··· 1364 1363 case FIP_VLAN_FAILED: 1365 1364 spin_unlock_irqrestore(&fnic->vlans_lock, flags); 1366 1365 /* if all vlans are in failed state, restart vlan disc */ 1367 - if (printk_ratelimit()) 1368 - FNIC_FCS_DBG(KERN_DEBUG, fnic->lport->host, 1369 - "Start VLAN Discovery\n"); 1366 + if (unlikely(fnic_log_level & FNIC_FCS_LOGGING)) 1367 + if (printk_ratelimit()) 1368 + shost_printk(KERN_DEBUG, fnic->lport->host, 1369 + "Start VLAN Discovery\n"); 1370 1370 fnic_event_enq(fnic, FNIC_EVT_START_VLAN_DISC); 1371 1371 break; 1372 1372 case FIP_VLAN_SENT: