lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <c391120e-897a-0ee1-d01a-0defe504d6df@huawei.com>
Date:   Thu, 7 Jan 2021 19:43:31 +0800
From:   lijinlin <lijinlin3@...wei.com>
To:     <linux-scsi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <jejb@...ux.ibm.com>, <martin.petersen@...cle.com>
CC:     <linfeilong@...wei.com>, <liuzhiqiang26@...wei.com>
Subject: scsi: Add diagnostic log for scsi device reset

From: lijinlin <lijinlin3@...wei.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@...wei.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ