Re: [PATCH] Fix fnic driver to remove bogus ratelimit messages.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2021-03-23 at 10:27 -0700, lduncan@xxxxxxxx wrote:
> From: Lee Duncan <lduncan@xxxxxxxx>
> 
> 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@xxxxxxxx>
> ---
>  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:

This looks good to me.
Reviewed-by: Laurence Oberman <loberman@xxxxxxxxxx>




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux