cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Ryan O'Hara <rohara@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 2/2] fence_scsi: always do sg_turs before registration
Date: Wed, 19 Jan 2011 14:30:47 -0600	[thread overview]
Message-ID: <1295469047-29601-1-git-send-email-rohara@redhat.com> (raw)

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



             reply	other threads:[~2011-01-19 20:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-19 20:30 Ryan O'Hara [this message]
2011-01-21 18:16 ` [Cluster-devel] [PATCH 2/2] fence_scsi: always do sg_turs before registration Lon Hohberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1295469047-29601-1-git-send-email-rohara@redhat.com \
    --to=rohara@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).