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

[Cluster-devel] cluster/fence/agents/scsi scsi_reserve



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL4
Changes by:	rohara sourceware org	2006-12-14 18:31:36

Modified files:
	fence/agents/scsi: scsi_reserve 

Log message:
	Allow 'stop' to release the reservation if and only if there are no other
	keys registered with a given device. Prior to this fix, if was not possible
	for 'scsi_reserve stop' to unregister/release on the node that was holding
	the reservation.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/scsi/scsi_reserve.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.6.7&r2=1.1.6.8

--- cluster/fence/agents/scsi/scsi_reserve	2006/12/12 23:20:28	1.1.6.7
+++ cluster/fence/agents/scsi/scsi_reserve	2006/12/14 18:31:36	1.1.6.8
@@ -97,10 +97,22 @@
 do
   echo -n "Unregistering device: $dev"
 
+  # get list of keys registered for this device
+  #
+  reg_keys=$( sg_persist -d $dev -i -k | grep '^[[:space:]]*0x' )
+
   # check if this node/key is the node/key holding the reservation
   #
   if sg_persist -d $dev -i -r 2>/dev/null | grep -qiE "${key#0}" ; then
-      error=1
+      if echo "$reg_keys" | grep -qivE "${key#0}" ; then
+	  error=1
+      else
+	  for error in 1
+	  do
+	    sg_persist -d $dev -o -G -K $key -S 0 &>/dev/null || break
+	    error=0
+	  done
+      fi
   else
       for error in 1
       do


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