[PATCH] scsi: st: Fix input/output error on empty drive reset

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

 



Tape drives are returning an "Input/output error" when a drive, the host, or
the bus is reset. This behavior is expected when a tape is present to prevent
data loss. However, the driver currently drops these errors even for empty
drives due to the following change:

Commit: 9604eea5bd3ae1fa3c098294f4fc29ad687141ea
Subject: scsi: st: Add third-party power-on reset handling
Link: https://github.com/torvalds/linux/commit/9604eea5bd3ae1fa3c098294f4fc29ad687141ea

This issue is causing several tape software applications to crash on startup or
when performing drive health checks, as noted in the following CERN CTA Tape
software discussion:
https://cta-community.web.cern.ch/t/input-output-error-from-tape-drive-device-dev-nst0/302

To correct this behavior, it is necessary to either check for the presence of a
tape before blocking the device or revise the drive's readiness verification at
the beginning of the flush function.

Signed-off-by: Rafael Rocha <rrochavi@xxxxxxxx>
---
 drivers/scsi/st.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 0d8ce1a92168..10bda3543e93 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -834,6 +834,9 @@ static int flush_buffer(struct scsi_tape *STp, int seek_next)
 	int backspace, result;
 	struct st_partstat *STps;
 
+	if (STp->ready != ST_READY)
+                return 0;
+
 	/*
 	 * If there was a bus reset, block further access
 	 * to this device.
@@ -841,8 +844,6 @@ static int flush_buffer(struct scsi_tape *STp, int seek_next)
 	if (STp->pos_unknown)
 		return (-EIO);
 
-	if (STp->ready != ST_READY)
-		return 0;
 	STps = &(STp->ps[STp->partition]);
 	if (STps->rw == ST_WRITING)	/* Writing */
 		return st_flush_write_buffer(STp);
-- 
2.39.3 (Apple Git-146)





[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