Skip to contentSkip to conversation

: Release legacy SPC-2 reservation during TMR LUN_RESET

PATCH New Nicholas A. Bellinger 1 participant 1 message Mar 8, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 : Release legacy SPC-2 reservation during TMR LUN_RESET

From: Nicholas Bellinger <[email protected]>

This patch updates core_tmr_lun_reset() to properly release any legacy SPC-2 reservations when a TMR LUN_RESET has been received. This only applys to legacy SPC-2 reservations, as >= SPC-3 persistent reservations is not effected by TMR LUN_RESET.

---
 drivers/target/target_core_tmr.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
drivers/target/target_core_tmr.c +12 -0
index 366c2f4..3cc2bf0 100644
@@ -383,6 +383,18 @@ int core_tmr_lun_reset(
 		spin_lock_irqsave(&qobj->cmd_queue_lock, flags);
 	}
 	spin_unlock_irqrestore(&qobj->cmd_queue_lock, flags);
+	/*
+	 * Clear any legacy SPC-2 reservation when called during
+	 * LOGICAL UNIT RESET
+	 */
+	if (!(preempt_and_abort_list) &&
+	     (dev->dev_flags & DF_SPC2_RESERVATIONS)) {
+		spin_lock(&dev->dev_reservation_lock);
+		dev->dev_reserved_node_acl = NULL;
+		dev->dev_flags &= ~DF_SPC2_RESERVATIONS;
+		spin_unlock(&dev->dev_reservation_lock);
+		printk(KERN_INFO "LUN_RESET: SCSI-2 Released reservation\n");	
+	}	
 
 #ifdef SNMP_SUPPORT
 	spin_lock(&dev->stats_lock);
Signature · 1 line
1.5.6.5