From: lijinlin <lijinlin3@huawei.com>
To: <linux-scsi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<jejb@linux.ibm.com>, <martin.petersen@oracle.com>
Cc: <linfeilong@huawei.com>, <liuzhiqiang26@huawei.com>
Subject: scsi: Add diagnostic log for scsi device reset
Date: Thu, 7 Jan 2021 19:43:31 +0800 [thread overview]
Message-ID: <c391120e-897a-0ee1-d01a-0defe504d6df@huawei.com> (raw)
From: lijinlin <lijinlin3@huawei.com>
For enhancing diagnosis capability when scsi device reset,we direct print
these logs which are infrequently printed, and add disk name to logs.
logs as follow:
[ 550.268049] sd 3:0:0:0: [sdc] Sending device reset
[ 550.268053] sd 3:0:0:0: [sdc] Sending target reset
[ 550.268055] sd 3:0:0:0: [sdc] Sending bus reset
[ 550.268056] sd 3:0:0:0: [sdc] Sending host reset
Signed-off-by: lijinlin <lijinlin3@huawei.com>
---
drivers/scsi/scsi_error.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index f11f51e..3e62ade 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1507,9 +1507,10 @@ static int scsi_eh_bus_device_reset(struct Scsi_Host *shost,
if (!bdr_scmd)
continue;
- SCSI_LOG_ERROR_RECOVERY(3,
+ if (bdr_scmd->request && bdr_scmd->request->rq_disk)
sdev_printk(KERN_INFO, sdev,
- "%s: Sending BDR\n", current->comm));
+ "[%s] Sending device reset\n",
+ bdr_scmd->request->rq_disk->disk_name);
rtn = scsi_try_bus_device_reset(bdr_scmd);
if (rtn == SUCCESS || rtn == FAST_IO_FAIL) {
if (!scsi_device_online(sdev) ||
@@ -1570,10 +1571,10 @@ static int scsi_eh_target_reset(struct Scsi_Host *shost,
scmd = list_entry(tmp_list.next, struct scsi_cmnd, eh_entry);
id = scmd_id(scmd);
- SCSI_LOG_ERROR_RECOVERY(3,
- shost_printk(KERN_INFO, shost,
- "%s: Sending target reset to target %d\n",
- current->comm, id));
+ if (scmd->device && scmd->request && scmd->request->rq_disk)
+ sdev_printk(KERN_INFO, scmd->device,
+ "[%s] Sending target reset\n",
+ scmd->request->rq_disk->disk_name);
rtn = scsi_try_target_reset(scmd);
if (rtn != SUCCESS && rtn != FAST_IO_FAIL)
SCSI_LOG_ERROR_RECOVERY(3,
@@ -1644,10 +1645,11 @@ static int scsi_eh_bus_reset(struct Scsi_Host *shost,
if (!chan_scmd)
continue;
- SCSI_LOG_ERROR_RECOVERY(3,
- shost_printk(KERN_INFO, shost,
- "%s: Sending BRST chan: %d\n",
- current->comm, channel));
+ if (chan_scmd->device && chan_scmd->request
+ && chan_scmd->request->rq_disk)
+ sdev_printk(KERN_INFO, chan_scmd->device,
+ "[%s] Sending bus reset\n",
+ chan_scmd->request->rq_disk->disk_name);
rtn = scsi_try_bus_reset(chan_scmd);
if (rtn == SUCCESS || rtn == FAST_IO_FAIL) {
list_for_each_entry_safe(scmd, next, work_q, eh_entry) {
@@ -1688,11 +1690,10 @@ static int scsi_eh_host_reset(struct Scsi_Host *shost,
scmd = list_entry(work_q->next,
struct scsi_cmnd, eh_entry);
- SCSI_LOG_ERROR_RECOVERY(3,
- shost_printk(KERN_INFO, shost,
- "%s: Sending HRST\n",
- current->comm));
-
+ if (scmd->device && scmd->request && scmd->request->rq_disk)
+ sdev_printk(KERN_INFO, scmd->device,
+ "[%s] Sending host reset\n",
+ scmd->request->rq_disk->disk_name);
rtn = scsi_try_host_reset(scmd);
if (rtn == SUCCESS) {
list_splice_init(work_q, &check_list);
--
1.8.3.1
next reply other threads:[~2021-01-07 11:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-07 11:43 lijinlin [this message]
2021-01-07 16:49 ` James Bottomley
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=c391120e-897a-0ee1-d01a-0defe504d6df@huawei.com \
--to=lijinlin3@huawei.com \
--cc=jejb@linux.ibm.com \
--cc=linfeilong@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=liuzhiqiang26@huawei.com \
--cc=martin.petersen@oracle.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®