From: bmarzins@sourceware.org
To: dm-cvs@sourceware.org, dm-devel@redhat.com
Subject: multipath-tools/libcheckers readsector0.c
Date: 11 Sep 2009 14:33:29 -0000 [thread overview]
Message-ID: <20090911143329.2131.qmail@sourceware.org> (raw)
CVSROOT: /cvs/dm
Module name: multipath-tools
Branch: RHEL5_FC6
Changes by: bmarzins@sourceware.org 2009-09-11 14:33:28
Modified files:
libcheckers : readsector0.c
Log message:
Backported scsi sense buffer retry code from upstream.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libcheckers/readsector0.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.5&r2=1.5.2.1
--- multipath-tools/libcheckers/readsector0.c 2006/07/13 19:49:22 1.5
+++ multipath-tools/libcheckers/readsector0.c 2009/09/11 14:33:28 1.5.2.1
@@ -14,6 +14,7 @@
#include "checkers.h"
#include "../libmultipath/sg_include.h"
+#include "../libmultipath/debug.h"
#define SENSE_BUFF_LEN 32
@@ -50,6 +51,7 @@
int res;
int rd_opcode[] = {0x8, 0x28, 0xa8, 0x88};
int sz_ind;
+ int retry_count = 3;
memset(rdCmd, 0, cdbsz);
sz_ind = 1;
@@ -75,6 +77,8 @@
if (diop && *diop)
io_hdr.flags |= SG_FLAG_DIRECT_IO;
+retry:
+ memset(senseBuff, 0, SENSE_BUFF_LEN);
while (((res = ioctl(sg_fd, SG_IO, &io_hdr)) < 0) && (EINTR == errno));
if (res < 0) {
@@ -89,6 +93,24 @@
(0 == io_hdr.driver_status)) {
return PATH_UP;
} else {
+ int key = 0;
+
+ if (io_hdr.sb_len_wr > 3) {
+ if (senseBuff[0] == 0x72 || senseBuff[0] == 0x73)
+ key = senseBuff[1] & 0x0f;
+ else if (io_hdr.sb_len_wr > 13 &&
+ ((senseBuff[0] & 0x7f) == 0x70 ||
+ (senseBuff[0] & 0x7f) == 0x71))
+ key = senseBuff[2] & 0x0f;
+ }
+
+ /*
+ * Retry if UNIT_ATTENTION check condition.
+ */
+ if (key == 0x6) {
+ if (--retry_count)
+ goto retry;
+ }
return PATH_DOWN;
}
}
reply other threads:[~2009-09-11 14:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20090911143329.2131.qmail@sourceware.org \
--to=bmarzins@sourceware.org \
--cc=dm-cvs@sourceware.org \
--cc=dm-devel@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