diff mbox series

scsi: use scmd_printk() to print which command timed out

Message ID 20190702112705.30458-1-mlombard@redhat.com (mailing list archive)
State Mainlined
Commit 463cdad83823830dd59572fb81ac243f6a44b589
Headers show
Series scsi: use scmd_printk() to print which command timed out | expand

Commit Message

Maurizio Lombardi July 2, 2019, 11:27 a.m. UTC
With a possibly faulty disk the following messages may appear in the logs:

kernel: sd 0:0:9:0: timing out command, waited 180s
kernel: sd 0:0:9:0: timing out command, waited 20s
kernel: sd 0:0:9:0: timing out command, waited 20s
kernel: sd 0:0:9:0: timing out command, waited 60s
kernel: sd 0:0:9:0: timing out command, waited 20s

This is not very informative because it's not possible to identify
the command that timed out.

This patch replaces sdev_printk() with scmd_printk().

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
 drivers/scsi/scsi_lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ewan Milne July 9, 2019, 6:13 p.m. UTC | #1
On Tue, 2019-07-02 at 13:27 +0200, Maurizio Lombardi wrote:
> With a possibly faulty disk the following messages may appear in the logs:
> 
> kernel: sd 0:0:9:0: timing out command, waited 180s
> kernel: sd 0:0:9:0: timing out command, waited 20s
> kernel: sd 0:0:9:0: timing out command, waited 20s
> kernel: sd 0:0:9:0: timing out command, waited 60s
> kernel: sd 0:0:9:0: timing out command, waited 20s
> 
> This is not very informative because it's not possible to identify
> the command that timed out.
> 
> This patch replaces sdev_printk() with scmd_printk().
> 
> Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
> ---
>  drivers/scsi/scsi_lib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index f6437b98296b..97ed233fa469 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1501,7 +1501,7 @@ static void scsi_softirq_done(struct request *rq)
>  	disposition = scsi_decide_disposition(cmd);
>  	if (disposition != SUCCESS &&
>  	    time_before(cmd->jiffies_at_alloc + wait_for, jiffies)) {
> -		sdev_printk(KERN_ERR, cmd->device,
> +		scmd_printk(KERN_ERR, cmd,
>  			    "timing out command, waited %lus\n",
>  			    wait_for/HZ);
>  		disposition = SUCCESS;

Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Ming Lei July 11, 2019, 1:04 a.m. UTC | #2
On Tue, Jul 2, 2019 at 7:28 PM Maurizio Lombardi <mlombard@redhat.com> wrote:
>
> With a possibly faulty disk the following messages may appear in the logs:
>
> kernel: sd 0:0:9:0: timing out command, waited 180s
> kernel: sd 0:0:9:0: timing out command, waited 20s
> kernel: sd 0:0:9:0: timing out command, waited 20s
> kernel: sd 0:0:9:0: timing out command, waited 60s
> kernel: sd 0:0:9:0: timing out command, waited 20s
>
> This is not very informative because it's not possible to identify
> the command that timed out.
>
> This patch replaces sdev_printk() with scmd_printk().
>
> Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
> ---
>  drivers/scsi/scsi_lib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index f6437b98296b..97ed233fa469 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1501,7 +1501,7 @@ static void scsi_softirq_done(struct request *rq)
>         disposition = scsi_decide_disposition(cmd);
>         if (disposition != SUCCESS &&
>             time_before(cmd->jiffies_at_alloc + wait_for, jiffies)) {
> -               sdev_printk(KERN_ERR, cmd->device,
> +               scmd_printk(KERN_ERR, cmd,
>                             "timing out command, waited %lus\n",
>                             wait_for/HZ);
>                 disposition = SUCCESS;
> --
> Maurizio Lombardi
>

Reviewed-by: Ming Lei <ming.lei@redhat.com>

Thanks,
Ming Lei
Martin K. Petersen July 12, 2019, 12:30 a.m. UTC | #3
Maurizio,

> With a possibly faulty disk the following messages may appear in the logs:

Applied to 5.3/scsi-fixes, thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index f6437b98296b..97ed233fa469 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1501,7 +1501,7 @@  static void scsi_softirq_done(struct request *rq)
 	disposition = scsi_decide_disposition(cmd);
 	if (disposition != SUCCESS &&
 	    time_before(cmd->jiffies_at_alloc + wait_for, jiffies)) {
-		sdev_printk(KERN_ERR, cmd->device,
+		scmd_printk(KERN_ERR, cmd,
 			    "timing out command, waited %lus\n",
 			    wait_for/HZ);
 		disposition = SUCCESS;