Bug 74672

Summary: qlogic FC drivers can't break SCSI reservations
Product: Red Hat Enterprise Linux 2.1 Reporter: James Bottomley <james.bottomley>
Component: kernelAssignee: Larry Woodman <lwoodman>
Status: CLOSED WONTFIX QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.1CC: andriusb
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-10-19 15:25:59 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description James Bottomley 2002-09-30 10:45:37 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020830

Description of problem:
In a multi-node cluster with simultaneous access to storage over a fibre bus, if
node a takes a reservation (using e.g. scsi_reserve package) then node b cannot
break it.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. take a reservation on node A
2. check that the reservation prevents access from node B
3. issue a reset from node B
4. check access again from node B.  Device will still be reserved
	

Actual Results:  reservation is still held

Expected Results:  reservation should be broken

Additional info:

This patch fixes the problem by forcing the qlogic drivers to issue a fibre TDR
on device reset (TDR is the fibre equivalent of SCSI device reset and thus
clears reservations).  The patch was picked up by qlogic in the 5.38 version of
their driver

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	rh2.4.9-e.3 -> qla2x00-rh-2.4.9-e.3
#	drivers/addon/qla2200_new/qla2x00.c	1.1     -> 1.2    
#	drivers/addon/qla2200/qla2x00.c	1.2     -> 1.3    
#	drivers/addon/qla2200_new/settings.h	1.1     -> 1.2    
#	drivers/scsi/qla2x00.c	1.1     -> 1.2    
#	drivers/addon/qla2200/settings.h	1.1     -> 1.2    
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/05	jejb@fenric.sc.steeleye.com	1.82
# tmp.diff
# --------------------------------------------
# 02/09/06	jejb@fenric.sc.steeleye.com	1.83
# qla2x00_5_31_abort_target.diff
# --------------------------------------------
# 02/09/06	jejb@fenric.sc.steeleye.com	1.84
# qla2x00src-v4.31Steeleye.patch
# --------------------------------------------
# 02/09/06	jejb@fenric.sc.steeleye.com	1.85
# Ported our TDR fix to version 5.31.RH3 (now qla2_00_new)
# --------------------------------------------
#
diff -Nru a/drivers/addon/qla2200/qla2x00.c b/drivers/addon/qla2200/qla2x00.c
--- a/drivers/addon/qla2200/qla2x00.c	Fri Sep  6 10:28:52 2002
+++ b/drivers/addon/qla2200/qla2x00.c	Fri Sep  6 10:28:52 2002
@@ -4843,23 +4843,25 @@
  */
 static int
 qla2x00_device_reset(struct scsi_qla_host * ha, uint16_t t) {
-	uint16_t l;
+	uint16_t l=0;
 	struct os_lun *lq;
 	fc_port_t *fcport;
 	uint8_t status = 0;
+	uint16_t mb[MAILBOX_REGISTER_COUNT]; 
 
 	ENTER("qla2x00_device_reset:");
 
-	for (l = 0; l < MAX_LUNS; l++) {
 		lq = LUN_Q(ha, t, l);
 		if (lq == NULL)
-			continue;
+			return 0;
 		fcport = lq->fclun->fcport;
 		if (LOOP_RDY(fcport->ha)) {
-			qla2x00_abort_device(fcport->ha, fcport->loop_id, lq->fclun->lun);
+			mb[0] = MBC_ABORT_TARGET;
+			mb[1] = fcport->loop_id << 8;
+			mb[2] = 1;
+		        status = qla2100_mailbox_command(ha, BIT_2| BIT_1 | BIT_0, &mb[0]);
 			qla2x00_marker(fcport->ha, fcport->loop_id, lq->fclun->lun, MK_SYNC_ID);
 		}
-	}
 	LEAVE("qla2x00_device_reset: exiting normally");
 	return status;
 }
diff -Nru a/drivers/addon/qla2200_new/qla2x00.c
b/drivers/addon/qla2200_new/qla2x00.c
--- a/drivers/addon/qla2200_new/qla2x00.c	Fri Sep  6 10:28:52 2002
+++ b/drivers/addon/qla2200_new/qla2x00.c	Fri Sep  6 10:28:52 2002
@@ -4989,23 +4989,25 @@
  */
 static int
 qla2x00_device_reset(struct scsi_qla_host * ha, uint16_t t) {
-	uint16_t l;
+	uint16_t l=0;
 	struct os_lun *lq;
 	fc_port_t *fcport;
 	uint8_t status = 0;
+	uint16_t mb[MAILBOX_REGISTER_COUNT]; 
 
 	ENTER("qla2x00_device_reset:");
 
-	for (l = 0; l < MAX_LUNS; l++) {
 		lq = LUN_Q(ha, t, l);
 		if (lq == NULL)
-			continue;
+			return 0;
 		fcport = lq->fclun->fcport;
 		if (LOOP_RDY(fcport->ha)) {
-			qla2x00_abort_device(fcport->ha, fcport->loop_id, lq->fclun->lun);
+			mb[0] = MBC_ABORT_TARGET;
+			mb[1] = fcport->loop_id << 8;
+			mb[2] = 1;
+		        status = qla2100_mailbox_command(ha, BIT_2 | BIT_1 | BIT_0, &mb[0]);
 			qla2x00_marker(fcport->ha, fcport->loop_id, lq->fclun->lun, MK_SYNC_ID);
 		}
-	}
 	LEAVE("qla2x00_device_reset: exiting normally");
 	return status;
 }
diff -Nru a/drivers/scsi/qla2x00.c b/drivers/scsi/qla2x00.c
--- a/drivers/scsi/qla2x00.c	Fri Sep  6 10:28:52 2002
+++ b/drivers/scsi/qla2x00.c	Fri Sep  6 10:28:52 2002
@@ -16,9 +16,11 @@
 * General Public License for more details.
 **
 ******************************************************************************/
-#define QLA2100_VERSION      "4.31.7b"
+#define QLA2100_VERSION      "4.31.7S"
 /****************************************************************************
 Revision History:
+    Rev. 4.31.7S		February 5, 2002	SteelEye Technology
+	- recover from RESERVATION CONFLICTS
     Rev. 4.31.7b		June 8, 2001		DG QLogic
 	- Fixed issue when loop id for target is changed to a different
 	 loop id.
@@ -10582,8 +10584,7 @@
                     q = GET_LU_Q(ha, b, t, l);
 
                     /* Target busy */
-                    if( pkt->scsi_status & SS_BUSY_CONDITION &&
-                    (uint8_t)pkt->scsi_status != SS_RESERVE_CONFLICT ) {
+                    if( pkt->scsi_status & SS_BUSY_CONDITION ) {
 #ifdef QL_DEBUG_LEVEL_2
                      qla2100_print("qla2100_status_entry: SCSI busy status,
scsi(");
                 qla2100_output_number((u_long)ha->host_no, 10);
@@ -10596,10 +10597,14 @@
                         qla2100_print(")\n");
 #endif
                         sp->retry_count--;
-                        CMD_RESULT(cp) = (int) (DID_BUS_BUSY << 16) |
-                        (pkt->scsi_status & 0xff);
+			/* Steeleye FIX:  if RESERVATION CONFLICT then return ABORT */
+			if ((uint8_t)pkt->scsi_status == SS_RESERVE_CONFLICT ) {
+                           CMD_RESULT(cp) = (int) (DID_ABORT << 16) |
(pkt->scsi_status & 0xff);
+			} else {
+    CMD_RESULT(cp) = (int) (DID_BUS_BUSY << 16) |
(pkt->scsi_status & 0xff);
+			}
 
-                    }
+		    }
 #if 0
                     /* dg - 03/30      */
                     else if( ha->loop_down_timer  ) {
Comment 1 RHEL Product and Program Management 2007-10-19 15:25:59 EDT
This bug is filed against RHEL2.1, which is in maintenance phase.
During the maintenance phase, only security errata and select mission
critical bug fixes will be released for enterprise products.  Since
this bug does not meet that criteria, it is now being closed.

For more information of the RHEL errata support policy, please visit:
http://www.redhat.com/security/updates/errata/

If you feel this bug is indeed mission critical, please contact your
support representative.  You may be asked to provide detailed
information on how this bug is affecting you.