[PATCH 1/1] scsi: sd: improved drive sanitize error handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



During the drive sanitization, when the sd driver issues TEST UNIT READY (TUR),
drive reports Sense Key: NOT_READY, ASC: 0x4 and ASCQ: 0x1b.

Sd driver issuing START_STOP command to spin up the drive.
This causes a hung and call trace occurred.

sd driver should take note of Sense Key: NOT_READY, ASC: 0x4 and ASCQ: 0x1b and
should not send START_STOP command until that condition clears.

Excerpt of dmesg:
[  206.998697] sd 6:0:0:0: [sda] tag#1 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[  206.998714] sd 6:0:0:0: [sda] tag#1 Sense Key : Not Ready [current]
[  206.998720] sd 6:0:0:0: [sda] tag#1 Add. Sense: Logical unit not ready, sanitize in progress
[  206.998727] sd 6:0:0:0: [sda] tag#1 CDB: Read(10) 28 00 00 00 00 04 00 00 04 00
[  206.998732] print_req_error: I/O error, dev sda, sector 4
[  206.998787] Buffer I/O error on dev sda, logical block 1, async page read
[  206.999786] sd 6:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[  206.999799] sd 6:0:0:0: [sda] tag#0 Sense Key : Not Ready [current]
[  206.999806] sd 6:0:0:0: [sda] tag#0 Add. Sense: Logical unit not ready, sanitize in progress
[  206.999812] sd 6:0:0:0: [sda] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 04 00
[  206.999816] print_req_error: I/O error, dev sda, sector 0
[  207.000127] Buffer I/O error on dev sda, logical block 0, async page read
[  207.000761] sd 6:0:0:0: [sda] tag#1 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[  207.000775] sd 6:0:0:0: [sda] tag#1 Sense Key : Not Ready [current]
[  207.000780] sd 6:0:0:0: [sda] tag#1 Add. Sense: Logical unit not ready, sanitize in progress
[  207.000786] sd 6:0:0:0: [sda] tag#1 CDB: Read(10) 28 00 00 00 00 04 00 00 04 00
[  207.000789] print_req_error: I/O error, dev sda, sector 4
[  207.000835] Buffer I/O error on dev sda, logical block 1, async page read
[  207.013461] Dev sda: unable to read RDB block 0
[  207.041607]  sda: unable to read partition table
[  207.051796] sd 6:0:0:0: [sda] Spinning up disk...
[  208.091576] ..................................
[  242.874325] INFO: task systemd-udevd:613 blocked for more than 120 seconds.
[  242.874391]       Tainted: G           OE    4.16.0-rc1+ #1
[  242.874445] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  242.874507] systemd-udevd   D    0   613    478 0x80000104
[  242.874512] Call Trace:
[  242.874524]  ? __schedule+0x297/0x870
[  242.874532]  ? _cond_resched+0x15/0x40
[  242.874537]  schedule+0x28/0x80
[  242.874542]  async_synchronize_cookie_domain+0x96/0x140
[  242.874547]  ? wait_woken+0x80/0x80
[  242.874553]  do_init_module+0xbc/0x201
[  242.874557]  load_module+0x1989/0x1f10
[  242.874565]  ? SYSC_finit_module+0xe9/0x110
[  242.874569]  SYSC_finit_module+0xe9/0x110
[  242.874577]  do_syscall_64+0x71/0x130
[  242.874584]  entry_SYSCALL_64_after_hwframe+0x21/0x86
[  242.874588] RIP: 0033:0x7fed93532a49
[  242.874591] RSP: 002b:00007fff9467b108 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[  242.874595] RAX: ffffffffffffffda RBX: 000055a3462a9380 RCX: 00007fed93532a49
[  242.874597] RDX: 0000000000000000 RSI: 00007fed9321e1c5 RDI: 000000000000000f
[  242.874600] RBP: 00007fed9321e1c5 R08: 0000000000000000 R09: 0000000000000000
[  242.874602] R10: 000000000000000f R11: 0000000000000246 R12: 0000000000000000
[  242.874604] R13: 000055a3462a7510 R14: 0000000000020000 R15: 000055a3462a9380
[  243.290259] ...............................................................not responding...
[  307.290719] sd 6:0:0:0: [sda] Attached SCSI disk

Signed-off-by: Mahesh Rajashekhara <mahesh.rajashekhara@xxxxxxxxxxxxx>
---
 drivers/scsi/sd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index a6201e6..9421d98 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2121,6 +2121,8 @@ sd_spinup_disk(struct scsi_disk *sdkp)
 				break;	/* standby */
 			if (sshdr.asc == 4 && sshdr.ascq == 0xc)
 				break;	/* unavailable */
+			if (sshdr.asc == 4 && sshdr.ascq == 0x1b)
+				break;	/* sanitize in progress */
 			/*
 			 * Issue command to spin up drive when not ready
 			 */
-- 
2.7.4




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux