linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] scsi: core: Log SCSI command age with errors
@ 2019-09-26  5:25 Milan P. Gandhi
  2019-09-26 15:34 ` Bart Van Assche
  2019-10-01  3:07 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Milan P. Gandhi @ 2019-09-26  5:25 UTC (permalink / raw)
  To: bvanassche, loberman, linux-kernel, linux-scsi; +Cc: jejb, martin.petersen

Couple of users had requested to print the SCSI command age along
with command failure errors. This is a small change, but allows
users to get more important information about the command that was
failed, it would help the users in debugging the command failures:

Signed-off-by: Milan P. Gandhi <mgandhi@redhat.com>
---

changes v2:
 - Changed the message to print SCSI command age as 'cmd_age'
   and not 'cmd-age' to avoid any confusion.

 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_logging.c b/drivers/scsi/scsi_logging.c
index 39b8cc4574b4..0ccb4c95266d 100644
--- a/drivers/scsi/scsi_logging.c
+++ b/drivers/scsi/scsi_logging.c
@@ -432,6 +432,7 @@ void scsi_print_result(const struct scsi_cmnd *cmd, const char *msg,
 	const char *mlret_string = scsi_mlreturn_string(disposition);
 	const char *hb_string = scsi_hostbyte_string(cmd->result);
 	const char *db_string = scsi_driverbyte_string(cmd->result);
+	unsigned long cmd_age = (jiffies - cmd->jiffies_at_alloc) / HZ;
 
 	logbuf = scsi_log_reserve_buffer(&logbuf_len);
 	if (!logbuf)
@@ -473,10 +474,15 @@ void scsi_print_result(const struct scsi_cmnd *cmd, const char *msg,
 
 	if (db_string)
 		off += scnprintf(logbuf + off, logbuf_len - off,
-				 "driverbyte=%s", db_string);
+				 "driverbyte=%s ", db_string);
 	else
 		off += scnprintf(logbuf + off, logbuf_len - off,
-				 "driverbyte=0x%02x", driver_byte(cmd->result));
+				 "driverbyte=0x%02x ",
+				 driver_byte(cmd->result));
+
+	off += scnprintf(logbuf + off, logbuf_len - off,
+			 "cmd_age=%lus", cmd_age);
+
 out_printk:
 	dev_printk(KERN_INFO, &cmd->device->sdev_gendev, "%s", logbuf);
 	scsi_log_release_buffer(logbuf);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] scsi: core: Log SCSI command age with errors
  2019-09-26  5:25 [PATCH v2] scsi: core: Log SCSI command age with errors Milan P. Gandhi
@ 2019-09-26 15:34 ` Bart Van Assche
  2019-10-01  3:07 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2019-09-26 15:34 UTC (permalink / raw)
  To: Milan P. Gandhi, loberman, linux-kernel, linux-scsi; +Cc: jejb, martin.petersen

On 9/25/19 10:25 PM, Milan P. Gandhi wrote:
> Couple of users had requested to print the SCSI command age along
> with command failure errors. This is a small change, but allows
> users to get more important information about the command that was
> failed, it would help the users in debugging the command failures:

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] scsi: core: Log SCSI command age with errors
  2019-09-26  5:25 [PATCH v2] scsi: core: Log SCSI command age with errors Milan P. Gandhi
  2019-09-26 15:34 ` Bart Van Assche
@ 2019-10-01  3:07 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2019-10-01  3:07 UTC (permalink / raw)
  To: Milan P. Gandhi
  Cc: bvanassche, loberman, linux-kernel, linux-scsi, jejb, martin.petersen


Milan,

> Couple of users had requested to print the SCSI command age along with
> command failure errors. This is a small change, but allows users to
> get more important information about the command that was failed, it
> would help the users in debugging the command failures:

Applied to 5.5/scsi-queue, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-01  3:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-26  5:25 [PATCH v2] scsi: core: Log SCSI command age with errors Milan P. Gandhi
2019-09-26 15:34 ` Bart Van Assche
2019-10-01  3:07 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).