Gitweb:
http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 337eecbdc58818617ae7124d1eeb0aeb002caf59
Parent: cecc4a5fd1e3f494d6f7cf2eeded1a5b77336336
Author: Ryan O'Hara <rohara(a)redhat.com>
AuthorDate: Wed Jan 19 14:18:54 2011 -0600
Committer: Ryan O'Hara <rohara(a)redhat.com>
CommitterDate: Fri Jan 21 12:39:30 2011 -0600
fence_scsi: always do sg_turs before registration
If a node has been fenced, or its key has been forcibly removed from
device(s) by another node, the victim will see "unit attention" from the
devices if/when it attempts to re-register. This error is normally
reported just once, but will cause registration to fail. We can safely
avoid this by calling sg_turs prior to each attempt to register with a
device.
Resolves: rhbz#640343
Signed-off-by: Ryan O'Hara <rohara(a)redhat.com>
Reviewed-by: Lon Hohberger <lhh(a)redhat.com>
---
fence/agents/scsi/fence_scsi.pl | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 818e1d9..10dc26a 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -46,6 +46,7 @@ sub do_action_on ($@)
log_error ("device $dev does not exist") if (! -e $dev);
log_error ("device $dev is not a block device") if (! -b $dev);
+ do_reset ($dev);
do_register_ignore ($node_key, $dev);
if (!get_reservation_key ($dev)) {
@@ -226,6 +227,23 @@ sub do_preempt_abort ($$$)
return;
}
+sub do_reset (S)
+{
+ my $self = (caller(0))[3];
+ my ($dev) = @_;
+
+ my $cmd = "sg_turs $dev";
+ my @out = qx { $cmd 2> /dev/null };
+ my $err = ($?>>8);
+
+ ## note that it is not necessarily an error is $err is non-zero,
+ ## so just log the device and status and continue.
+
+ log_debug ("$self (dev=$dev, status=$err)");
+
+ return;
+}
+
sub key_read ()
{
my $self = (caller(0))[3];