Skip to contentSkip to conversation

cluster/fence/agents/scsi scsi_reserve

Cluster-devel [email protected] 1 participant 1 message Dec 14, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL4
Changes by: rohara at 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

fence/agents/scsi/scsi_reserve +13 -1
@@ -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