All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: "Ewan D. Milne" <emilne@redhat.com>, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: avoid repetitive logging of device offline messages
Date: Mon, 09 Mar 2020 12:05:54 -0700	[thread overview]
Message-ID: <1583780754.3429.26.camel@HansenPartnership.com> (raw)
In-Reply-To: <20200309181416.10665-1-emilne@redhat.com>

On Mon, 2020-03-09 at 14:14 -0400, Ewan D. Milne wrote:
> Large queues of I/O to offline devices that are eventually
> submitted when devices are unblocked result in a many repeated
> "rejecting I/O to offline device" messages.  These messages
> can fill up the dmesg buffer in crash dumps so no useful
> prior messages remain.  In addition, if a serial console
> is used, the flood of messages can cause a hard lockup in
> the console code.
> 
> Introduce a flag indicating the message has already been logged
> for the device, and reset the flag when scsi_device_set_state()
> changes the device state.
> 
> Signed-off-by: Ewan D. Milne <emilne@redhat.com>
> ---
>  drivers/scsi/scsi_lib.c    | 8 ++++++--
>  include/scsi/scsi_device.h | 2 ++
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 610ee41..d3a6d97 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1240,8 +1240,11 @@ scsi_prep_state_check(struct scsi_device
> *sdev, struct request *req)
>  		 * commands.  The device must be brought online
>  		 * before trying any recovery commands.
>  		 */
> -		sdev_printk(KERN_ERR, sdev,
> -			    "rejecting I/O to offline device\n");
> +		if (!sdev->offline_already) {
> +			sdev->offline_already = 1;
> +			sdev_printk(KERN_ERR, sdev,
> +				    "rejecting I/O to offline
> device\n");
> +		}

Offline->online is a legal transition, so you'll need to clear this
flag when that happens so we get another offline message if it goes
offline again.

James


  reply	other threads:[~2020-03-09 19:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-09 18:14 [PATCH] scsi: avoid repetitive logging of device offline messages Ewan D. Milne
2020-03-09 19:05 ` James Bottomley [this message]
2020-03-09 20:49   ` Ewan D. Milne
2020-03-10  3:58     ` Douglas Gilbert
2020-03-09 19:36 ` Bart Van Assche
2020-03-09 20:54   ` Ewan D. Milne
2020-03-10  2:02     ` Bart Van Assche
2020-03-10 16:44       ` Ewan D. Milne
2020-03-11  4:01         ` Bart Van Assche
2020-03-11  5:12           ` Douglas Gilbert
2020-03-11 14:38           ` Ewan D. Milne
2020-03-09 22:36 ` Laurence Oberman

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=1583780754.3429.26.camel@HansenPartnership.com \
    --to=james.bottomley@hansenpartnership.com \
    --cc=emilne@redhat.com \
    --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.