FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 01-19-2011, 07:30 PM
"Ryan O'Hara"
 
Default 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@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];
--
1.7.3.4
 
Old 01-24-2011, 05:57 PM
"Ryan O'Hara"
 
Default fence_scsi: always do sg_turs before registration

This patch fixes a with the original patch posted last week. Before
attempting to register with a device, we should call sg_turs on the
device. If that device is a dm-multipath device, we should call sg_turs
on all the paths. This can be done by simply moving the call to do_reset
to do_register and do_register_ignore.

Also, the patch adds a call to do_reset before doing a "status" action.
If a node has been fenced and then proceeds to check its status, it will
be in "unit attention" state.

Resolves: rhbz#640343

Signed-off-by: Ryan O'Hara <rohara@redhat.com>
---
fence/agents/scsi/fence_scsi.pl | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 10dc26a..5156881 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -46,7 +46,6 @@ 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)) {
@@ -94,6 +93,8 @@ sub do_action_status ($@)
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);
+
my @keys = grep { /^$node_key$/ } get_registration_keys ($dev);

if (scalar (@keys) != 0) {
@@ -129,6 +130,8 @@ sub do_register ($$$)
my $cmd;
my $out;

+ do_reset ($dev);
+
$cmd = "sg_persist -n -o -G -K $host_key -S $node_key -d $dev";
$cmd .= " -Z" if (defined $opt_a);
$out = qx { $cmd };
@@ -158,11 +161,13 @@ sub do_register_ignore ($$)
my $cmd;
my $out;

+ do_reset ($dev);
+
$cmd = "sg_persist -n -o -I -S $node_key -d $dev";
$cmd .= " -Z" if (defined $opt_a);
$out = qx { $cmd };

- die "[error]: $self
" if ($?>>8);
+ die "[error]: $self ($dev)
" if ($?>>8);

return;
}
--
1.7.3.4
 

Thread Tools




All times are GMT. The time now is 09:47 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org