From 5f91bb050ecc4ff1d8d3d07edbe550c8f431c5e1 Mon Sep 17 00:00:00 2001
From: Michael Reed <mdr@sgi.com>
Date: Mon, 10 Aug 2009 11:59:28 -0500
Subject: [SCSI] reservation conflict after timeout causes device to be taken
 offline

An IBM tape drive failed to complete a PERSISTENT RESERVE IN within the scsi
cmd timeout.  Error recovery was initiated and it sequenced from abort through
taking the tape drive offline.

The device was taken offline because it repeatedly responded to the TUR command
issued by error recovery with a RESERVATION CONFLICT status.  The tape drive
was reserved to another system.  This is perfectly legitimate response to TUR,
and is one that an escalation of recovery is unlikely to clear.  Further,
escalation of recovery can have undesirable side effects on the operation of
tape drives shared with other initiators.

Instead of escalating recovery, error recovery should treat the RESERVATION
CONFLICT response to the TUR as a good status, giving the issuer of the
command the opportunity to handle the timeout and reservation conflict.

Signed-off-by: Michael reed <mdr@sgi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
---
 drivers/scsi/scsi_error.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index a1689353d7f..877204daf54 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -382,9 +382,13 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
 		 * who knows?  FIXME(eric)
 		 */
 		return SUCCESS;
+	case RESERVATION_CONFLICT:
+		/*
+		 * let issuer deal with this, it could be just fine
+		 */
+		return SUCCESS;
 	case BUSY:
 	case QUEUE_FULL:
-	case RESERVATION_CONFLICT:
 	default:
 		return FAILED;
 	}
-- 
cgit v1.2.3-70-g09d2