basebuilder_pel7ppc64bebuilder0
7 years ago
14 changed files with 1809 additions and 0 deletions
@ -0,0 +1,920 @@
@@ -0,0 +1,920 @@
|
||||
From 4fed8b17b1cd75492d20cf701ebe4f66e13385f5 Mon Sep 17 00:00:00 2001 |
||||
From: David Sommerseth <davids@redhat.com> |
||||
Date: Fri, 29 Apr 2016 01:12:20 +0200 |
||||
Subject: [PATCH] Add upstream updates to sg_inq, sg_rdac and sg_vpd |
||||
|
||||
--- |
||||
src/sg_inq.c | 165 +++++++++++++++++++++++++++++++----- |
||||
src/sg_rdac.c | 216 ++++++++++++++++++++++++++++++++++------------- |
||||
src/sg_vpd_vendor.c | 239 +++++++++++++++++++++++++++++++++++++++++++++++----- |
||||
3 files changed, 519 insertions(+), 101 deletions(-) |
||||
|
||||
diff --git a/src/sg_inq.c b/src/sg_inq.c |
||||
index 80c8aec..9666e08 100644 |
||||
--- a/src/sg_inq.c |
||||
+++ b/src/sg_inq.c |
||||
@@ -2225,8 +2225,8 @@ decode_rdac_vpd_c2(unsigned char * buff, int len) |
||||
"not possible.\n" , buff[4], buff[5], buff[6], buff[7]); |
||||
return; |
||||
} |
||||
- printf(" Software Version: %d.%d.%d\n", buff[8], buff[9], buff[10]); |
||||
- printf(" Software Date: %02x/%02x/%02x\n", buff[11], buff[12], buff[13]); |
||||
+ printf(" Software Version: %02x.%02x.%02x\n", buff[8], buff[9], buff[10]); |
||||
+ printf(" Software Date: %02d/%02d/%02d\n", buff[11], buff[12], buff[13]); |
||||
printf(" Features:"); |
||||
if (buff[14] & 0x01) |
||||
printf(" Dual Active,"); |
||||
@@ -2235,15 +2235,77 @@ decode_rdac_vpd_c2(unsigned char * buff, int len) |
||||
if (buff[14] & 0x04) |
||||
printf(" Multiple Sub-enclosures,"); |
||||
if (buff[14] & 0x08) |
||||
- printf(" DCE/DRM,"); |
||||
+ printf(" DCE/DRM/DSS/DVE,"); |
||||
if (buff[14] & 0x10) |
||||
- printf(" AVT,"); |
||||
+ printf(" Asymmetric Logical Unit Access,"); |
||||
printf("\n"); |
||||
printf(" Max. #of LUNS: %d\n", buff[15]); |
||||
return; |
||||
} |
||||
|
||||
static void |
||||
+decode_rdac_vpd_c9_rtpg_data(unsigned char aas, unsigned char vendor) |
||||
+{ |
||||
+ printf(" Asymmetric Access State:"); |
||||
+ switch(aas & 0x0F) { |
||||
+ case 0x0: |
||||
+ printf(" Active/Optimized"); |
||||
+ break; |
||||
+ case 0x1: |
||||
+ printf(" Active/Non-Optimized"); |
||||
+ break; |
||||
+ case 0x2: |
||||
+ printf(" Standby"); |
||||
+ break; |
||||
+ case 0x3: |
||||
+ printf(" Unavailable"); |
||||
+ break; |
||||
+ case 0xE: |
||||
+ printf(" Offline"); |
||||
+ break; |
||||
+ case 0xF: |
||||
+ printf(" Transitioning"); |
||||
+ break; |
||||
+ default: |
||||
+ printf(" (unknown)"); |
||||
+ break; |
||||
+ } |
||||
+ printf("\n"); |
||||
+ |
||||
+ printf(" Vendor Specific Field:"); |
||||
+ switch(vendor) { |
||||
+ case 0x01: |
||||
+ printf(" Operating normally"); |
||||
+ break; |
||||
+ case 0x02: |
||||
+ printf(" Non-responsive to queries"); |
||||
+ break; |
||||
+ case 0x03: |
||||
+ printf(" Controller being held in reset"); |
||||
+ break; |
||||
+ case 0x04: |
||||
+ printf(" Performing controller firmware download (1st controller)"); |
||||
+ break; |
||||
+ case 0x05: |
||||
+ printf(" Performing controller firmware download (2nd controller)"); |
||||
+ break; |
||||
+ case 0x06: |
||||
+ printf(" Quiesced as a result of an administrative request"); |
||||
+ break; |
||||
+ case 0x07: |
||||
+ printf(" Service mode as a result of an administrative request"); |
||||
+ break; |
||||
+ case 0xFF: |
||||
+ printf(" Details are not available"); |
||||
+ break; |
||||
+ default: |
||||
+ printf(" (unknown)"); |
||||
+ break; |
||||
+ } |
||||
+ printf("\n"); |
||||
+} |
||||
+ |
||||
+static void |
||||
decode_rdac_vpd_c9(unsigned char * buff, int len) |
||||
{ |
||||
if (len < 3) { |
||||
@@ -2260,14 +2322,18 @@ decode_rdac_vpd_c9(unsigned char * buff, int len) |
||||
fprintf(stderr, "Invalid page version '%c' (should be 1)\n", |
||||
buff[7]); |
||||
} |
||||
- printf(" AVT:"); |
||||
- if (buff[8] & 0x80) { |
||||
- printf(" Enabled"); |
||||
- if (buff[8] & 0x40) |
||||
- printf(" (Allow reads on sector 0)"); |
||||
- printf("\n"); |
||||
+ if ( (buff[8] & 0xE0) == 0xE0 ) { |
||||
+ printf(" IOShipping (ALUA): Enabled\n"); |
||||
} else { |
||||
- printf(" Disabled\n"); |
||||
+ printf(" AVT:"); |
||||
+ if (buff[8] & 0x80) { |
||||
+ printf(" Enabled"); |
||||
+ if (buff[8] & 0x40) |
||||
+ printf(" (Allow reads on sector 0)"); |
||||
+ printf("\n"); |
||||
+ } else { |
||||
+ printf(" Disabled\n"); |
||||
+ } |
||||
} |
||||
printf(" Volume Access via: "); |
||||
if (buff[8] & 0x01) |
||||
@@ -2275,17 +2341,72 @@ decode_rdac_vpd_c9(unsigned char * buff, int len) |
||||
else |
||||
printf("alternate controller\n"); |
||||
|
||||
- printf(" Path priority: %d ", buff[9] & 0xf); |
||||
- switch(buff[9] & 0xf) { |
||||
- case 0x1: |
||||
- printf("(preferred path)\n"); |
||||
- break; |
||||
- case 0x2: |
||||
- printf("(secondary path)\n"); |
||||
- break; |
||||
- default: |
||||
- printf("(unknown)\n"); |
||||
- break; |
||||
+ if (buff[8] & 0x08) { |
||||
+ printf(" Path priority: %d ", buff[15] & 0xf); |
||||
+ switch(buff[15] & 0xf) { |
||||
+ case 0x1: |
||||
+ printf("(preferred path)\n"); |
||||
+ break; |
||||
+ case 0x2: |
||||
+ printf("(secondary path)\n"); |
||||
+ break; |
||||
+ default: |
||||
+ printf("(unknown)\n"); |
||||
+ break; |
||||
+ } |
||||
+ |
||||
+ printf(" Preferred Path Auto Changeable:"); |
||||
+ switch(buff[14] & 0x3C) { |
||||
+ case 0x14: |
||||
+ printf(" No (User Disabled and Host Type Restricted)\n"); |
||||
+ break; |
||||
+ case 0x18: |
||||
+ printf(" No (User Disabled)\n"); |
||||
+ break; |
||||
+ case 0x24: |
||||
+ printf(" No (Host Type Restricted)\n"); |
||||
+ break; |
||||
+ case 0x28: |
||||
+ printf(" Yes\n"); |
||||
+ break; |
||||
+ default: |
||||
+ printf(" (Unknown)\n"); |
||||
+ break; |
||||
+ } |
||||
+ |
||||
+ printf(" Implicit Failback:"); |
||||
+ switch(buff[14] & 0x03) { |
||||
+ case 0x1: |
||||
+ printf(" Disabled\n"); |
||||
+ break; |
||||
+ case 0x2: |
||||
+ printf(" Enabled\n"); |
||||
+ break; |
||||
+ default: |
||||
+ printf(" (Unknown)\n"); |
||||
+ break; |
||||
+ } |
||||
+ } else { |
||||
+ printf(" Path priority: %d ", buff[9] & 0xf); |
||||
+ switch(buff[9] & 0xf) { |
||||
+ case 0x1: |
||||
+ printf("(preferred path)\n"); |
||||
+ break; |
||||
+ case 0x2: |
||||
+ printf("(secondary path)\n"); |
||||
+ break; |
||||
+ default: |
||||
+ printf("(unknown)\n"); |
||||
+ break; |
||||
+ } |
||||
+ } |
||||
+ |
||||
+ if (buff[8] & 0x80) { |
||||
+ printf(" Target Port Group Data (This controller):\n"); |
||||
+ decode_rdac_vpd_c9_rtpg_data(buff[10], buff[11]); |
||||
+ |
||||
+ printf(" Target Port Group Data (Alternate controller):\n"); |
||||
+ decode_rdac_vpd_c9_rtpg_data(buff[12], buff[13]); |
||||
} |
||||
|
||||
return; |
||||
diff --git a/src/sg_rdac.c b/src/sg_rdac.c |
||||
index 41ec544..ea243a2 100644 |
||||
--- a/src/sg_rdac.c |
||||
+++ b/src/sg_rdac.c |
||||
@@ -28,12 +28,20 @@ |
||||
static const char * version_str = "1.06 20130507"; |
||||
|
||||
unsigned char mode6_hdr[] = { |
||||
- 75, /* Length */ |
||||
+ 0x75, /* Length */ |
||||
0, /* medium */ |
||||
0, /* params */ |
||||
8, /* Block descriptor length */ |
||||
}; |
||||
|
||||
+unsigned char mode10_hdr[] = { |
||||
+ 0x01, 0x18, /* Length */ |
||||
+ 0, /* medium */ |
||||
+ 0, /* params */ |
||||
+ 0, 0, /* reserved */ |
||||
+ 0, 0, /* block descriptor length */ |
||||
+}; |
||||
+ |
||||
unsigned char block_descriptor[] = { |
||||
0, /* Density code */ |
||||
0, 0, 0, /* Number of blocks */ |
||||
@@ -41,22 +49,35 @@ unsigned char block_descriptor[] = { |
||||
0, 0x02, 0, /* 512 byte blocks */ |
||||
}; |
||||
|
||||
-struct rdac_legacy_page { |
||||
- unsigned char page_code; |
||||
- unsigned char page_length; |
||||
- char current_serial[16]; |
||||
- char alternate_serial[16]; |
||||
+struct rdac_page_common { |
||||
+ unsigned char current_serial[16]; |
||||
+ unsigned char alternate_serial[16]; |
||||
unsigned char current_mode_msb; |
||||
unsigned char current_mode_lsb; |
||||
unsigned char alternate_mode_msb; |
||||
unsigned char alternate_mode_lsb; |
||||
unsigned char quiescence; |
||||
unsigned char options; |
||||
+}; |
||||
+ |
||||
+struct rdac_legacy_page { |
||||
+ unsigned char page_code; |
||||
+ unsigned char page_length; |
||||
+ struct rdac_page_common attr; |
||||
unsigned char lun_table[32]; |
||||
unsigned char lun_table_exp[32]; |
||||
unsigned short reserved; |
||||
}; |
||||
|
||||
+struct rdac_expanded_page { |
||||
+ unsigned char page_code; |
||||
+ unsigned char subpage_code; |
||||
+ unsigned char page_length[2]; |
||||
+ struct rdac_page_common attr; |
||||
+ unsigned char lun_table[256]; |
||||
+ unsigned char reserved[2]; |
||||
+}; |
||||
+ |
||||
static int do_verbose = 0; |
||||
|
||||
static void dump_mode_page( unsigned char *page, int len ) |
||||
@@ -83,30 +104,52 @@ static void dump_mode_page( unsigned char *page, int len ) |
||||
#define RDAC_CONTROLLER_PAGE_LEN 0x68 |
||||
#define LEGACY_PAGE 0x00 |
||||
#define EXPANDED_LUN_SPACE_PAGE 0x01 |
||||
+#define EXPANDED_LUN_SPACE_PAGE_LEN 0x128 |
||||
#define RDAC_FAIL_ALL_PATHS 0x1 |
||||
#define RDAC_FAIL_SELECTED_PATHS 0x2 |
||||
#define RDAC_FORCE_QUIESCENCE 0x2 |
||||
#define RDAC_QUIESCENCE_TIME 10 |
||||
|
||||
-static int fail_all_paths(int fd) |
||||
+static int fail_all_paths(int fd, int use_6_byte) |
||||
{ |
||||
- unsigned char fail_paths_pg[118]; |
||||
+ unsigned char fail_paths_pg[308]; |
||||
struct rdac_legacy_page *rdac_page; |
||||
+ struct rdac_expanded_page *rdac_page_exp; |
||||
+ struct rdac_page_common *rdac_common = NULL; |
||||
+ |
||||
int res; |
||||
|
||||
- memset(fail_paths_pg, 0, 118); |
||||
- memcpy(fail_paths_pg, mode6_hdr, 4); |
||||
- memcpy(fail_paths_pg + 4, block_descriptor, 8); |
||||
- rdac_page = (struct rdac_legacy_page *)(fail_paths_pg + 4 + 8); |
||||
- rdac_page->page_code = RDAC_CONTROLLER_PAGE | 0x40; |
||||
- rdac_page->page_length = RDAC_CONTROLLER_PAGE_LEN; |
||||
- rdac_page->quiescence = RDAC_QUIESCENCE_TIME; |
||||
- rdac_page->options = RDAC_FORCE_QUIESCENCE; |
||||
- rdac_page->current_mode_lsb = RDAC_FAIL_ALL_PATHS; |
||||
+ memset(fail_paths_pg, 0, 308); |
||||
+ if (use_6_byte) { |
||||
+ memcpy(fail_paths_pg, mode6_hdr, 4); |
||||
+ memcpy(fail_paths_pg + 4, block_descriptor, 8); |
||||
+ rdac_page = (struct rdac_legacy_page *)(fail_paths_pg + 4 + 8); |
||||
+ rdac_page->page_code = RDAC_CONTROLLER_PAGE; |
||||
+ rdac_page->page_length = RDAC_CONTROLLER_PAGE_LEN; |
||||
+ rdac_common = &rdac_page->attr; |
||||
+ } else { |
||||
+ memcpy(fail_paths_pg, mode10_hdr, 8); |
||||
+ rdac_page_exp = (struct rdac_expanded_page *)(fail_paths_pg + 8); |
||||
+ rdac_page_exp->page_code = RDAC_CONTROLLER_PAGE | 0x40; |
||||
+ rdac_page_exp->subpage_code = 0x1; |
||||
+ rdac_page_exp->page_length[0] = EXPANDED_LUN_SPACE_PAGE_LEN >> 8; |
||||
+ rdac_page_exp->page_length[1] = EXPANDED_LUN_SPACE_PAGE_LEN & 0xFF; |
||||
+ rdac_common = &rdac_page_exp->attr; |
||||
+ } |
||||
|
||||
- res = sg_ll_mode_select6(fd, 1 /* pf */, 0 /* sp */, |
||||
- fail_paths_pg, 118, |
||||
- 1, (do_verbose ? 2 : 0)); |
||||
+ rdac_common->current_mode_lsb = RDAC_FAIL_ALL_PATHS; |
||||
+ rdac_common->quiescence = RDAC_QUIESCENCE_TIME; |
||||
+ rdac_common->options = RDAC_FORCE_QUIESCENCE; |
||||
+ |
||||
+ if (use_6_byte) { |
||||
+ res = sg_ll_mode_select6(fd, 1 /* pf */, 0 /* sp */, |
||||
+ fail_paths_pg, 118, |
||||
+ 1, (do_verbose ? 2 : 0)); |
||||
+ } else { |
||||
+ res = sg_ll_mode_select10(fd, 1 /* pf */, 0 /* sp */, |
||||
+ fail_paths_pg, 308, |
||||
+ 1, (do_verbose ? 2: 0)); |
||||
+ } |
||||
|
||||
switch (res) { |
||||
case 0: |
||||
@@ -137,27 +180,54 @@ static int fail_all_paths(int fd) |
||||
return res; |
||||
} |
||||
|
||||
-static int fail_this_path(int fd, int lun) |
||||
+static int fail_this_path(int fd, int lun, int use_6_byte) |
||||
{ |
||||
- unsigned char fail_paths_pg[118]; |
||||
+ unsigned char fail_paths_pg[308]; |
||||
struct rdac_legacy_page *rdac_page; |
||||
+ struct rdac_expanded_page *rdac_page_exp; |
||||
+ struct rdac_page_common *rdac_common = NULL; |
||||
int res; |
||||
|
||||
- memset(fail_paths_pg, 0, 118); |
||||
- memcpy(fail_paths_pg, mode6_hdr, 4); |
||||
- memcpy(fail_paths_pg + 4, block_descriptor, 8); |
||||
- rdac_page = (struct rdac_legacy_page *)(fail_paths_pg + 4 + 8); |
||||
- rdac_page->page_code = RDAC_CONTROLLER_PAGE | 0x40; |
||||
- rdac_page->page_length = RDAC_CONTROLLER_PAGE_LEN; |
||||
- rdac_page->current_mode_lsb = RDAC_FAIL_SELECTED_PATHS; |
||||
- rdac_page->quiescence = RDAC_QUIESCENCE_TIME; |
||||
- rdac_page->options = RDAC_FORCE_QUIESCENCE; |
||||
- memset(rdac_page->lun_table, 0x0, 32); |
||||
- rdac_page->lun_table[lun] = 0x81; |
||||
- |
||||
- res = sg_ll_mode_select6(fd, 1 /* pf */, 0 /* sp */, |
||||
- fail_paths_pg, 118, |
||||
- 1, (do_verbose ? 2 : 0)); |
||||
+ if (use_6_byte && lun > 32) { |
||||
+ fprintf(stderr, "must use 10 byte cdb to fail luns over 32\n"); |
||||
+ return -1; |
||||
+ } |
||||
+ |
||||
+ memset(fail_paths_pg, 0, 308); |
||||
+ if (use_6_byte) { |
||||
+ memcpy(fail_paths_pg, mode6_hdr, 4); |
||||
+ memcpy(fail_paths_pg + 4, block_descriptor, 8); |
||||
+ rdac_page = (struct rdac_legacy_page *)(fail_paths_pg + 4 + 8); |
||||
+ rdac_page->page_code = RDAC_CONTROLLER_PAGE; |
||||
+ rdac_page->page_length = RDAC_CONTROLLER_PAGE_LEN; |
||||
+ rdac_common = &rdac_page->attr; |
||||
+ memset(rdac_page->lun_table, 0x0, 32); |
||||
+ rdac_page->lun_table[lun] = 0x81; |
||||
+ } else { |
||||
+ memcpy(fail_paths_pg, mode10_hdr, 8); |
||||
+ rdac_page_exp = (struct rdac_expanded_page *)(fail_paths_pg + 8); |
||||
+ rdac_page_exp->page_code = RDAC_CONTROLLER_PAGE | 0x40; |
||||
+ rdac_page_exp->subpage_code = 0x1; |
||||
+ rdac_page_exp->page_length[0] = EXPANDED_LUN_SPACE_PAGE_LEN >> 8; |
||||
+ rdac_page_exp->page_length[1] = EXPANDED_LUN_SPACE_PAGE_LEN & 0xFF; |
||||
+ rdac_common = &rdac_page_exp->attr; |
||||
+ memset(rdac_page_exp->lun_table, 0x0, 256); |
||||
+ rdac_page_exp->lun_table[lun] = 0x81; |
||||
+ } |
||||
+ |
||||
+ rdac_common->current_mode_lsb = RDAC_FAIL_SELECTED_PATHS; |
||||
+ rdac_common->quiescence = RDAC_QUIESCENCE_TIME; |
||||
+ rdac_common->options = RDAC_FORCE_QUIESCENCE; |
||||
+ |
||||
+ if (use_6_byte) { |
||||
+ res = sg_ll_mode_select6(fd, 1 /* pf */, 0 /* sp */, |
||||
+ fail_paths_pg, 118, |
||||
+ 1, (do_verbose ? 2 : 0)); |
||||
+ } else { |
||||
+ res = sg_ll_mode_select10(fd, 1 /* pf */, 0 /* sp */, |
||||
+ fail_paths_pg, 308, |
||||
+ 1, (do_verbose ? 2: 0)); |
||||
+ } |
||||
|
||||
switch (res) { |
||||
case 0: |
||||
@@ -189,16 +259,29 @@ static int fail_this_path(int fd, int lun) |
||||
return res; |
||||
} |
||||
|
||||
-static void print_rdac_mode( unsigned char *ptr ) |
||||
+static void print_rdac_mode( unsigned char *ptr, int subpg) |
||||
{ |
||||
- struct rdac_legacy_page *rdac_ptr; |
||||
- int i, k, bd_len; |
||||
- |
||||
- bd_len = ptr[3]; |
||||
- |
||||
- rdac_ptr = (struct rdac_legacy_page *)(ptr + 4 + bd_len); |
||||
+ struct rdac_legacy_page *legacy; |
||||
+ struct rdac_expanded_page *expanded; |
||||
+ struct rdac_page_common *rdac_ptr = NULL; |
||||
+ unsigned char * lun_table = NULL; |
||||
+ int i, k, bd_len, lun_table_len; |
||||
+ |
||||
+ if (subpg == 1) { |
||||
+ bd_len = ptr[7]; |
||||
+ expanded = (struct rdac_expanded_page *)(ptr + 8 + bd_len); |
||||
+ rdac_ptr = &expanded->attr; |
||||
+ lun_table = expanded->lun_table; |
||||
+ lun_table_len = 256; |
||||
+ } else { |
||||
+ bd_len = ptr[3]; |
||||
+ legacy = (struct rdac_legacy_page *)(ptr + 4 + bd_len); |
||||
+ rdac_ptr = &legacy->attr; |
||||
+ lun_table = legacy->lun_table; |
||||
+ lun_table_len = 32; |
||||
+ } |
||||
|
||||
- printf("RDAC Legacy page\n"); |
||||
+ printf("RDAC %s page\n", (subpg == 1) ? "Expanded" : "Legacy"); |
||||
printf(" Controller serial: %s\n", |
||||
rdac_ptr->current_serial); |
||||
printf(" Alternate controller serial: %s\n", |
||||
@@ -239,9 +322,6 @@ static void print_rdac_mode( unsigned char *ptr ) |
||||
case 0x01: |
||||
printf("alternate controller present; "); |
||||
break; |
||||
- case 0x02: |
||||
- printf("active/active mode; "); |
||||
- break; |
||||
default: |
||||
printf("(Unknown status 0x%x); ", |
||||
rdac_ptr->alternate_mode_msb); |
||||
@@ -257,7 +337,10 @@ static void print_rdac_mode( unsigned char *ptr ) |
||||
case 0x2: |
||||
printf("Dual active mode\n"); |
||||
break; |
||||
- case 0x04: |
||||
+ case 0x3: |
||||
+ printf("Not present\n"); |
||||
+ break; |
||||
+ case 0x4: |
||||
printf("held in reset\n"); |
||||
break; |
||||
default: |
||||
@@ -266,11 +349,14 @@ static void print_rdac_mode( unsigned char *ptr ) |
||||
} |
||||
printf(" Quiescence timeout: %d\n", rdac_ptr->quiescence); |
||||
printf(" RDAC option 0x%x\n", rdac_ptr->options); |
||||
- printf (" LUN Table:\n"); |
||||
- for (k = 0; k < 32; k += 8) { |
||||
- printf(" %x:",k / 8); |
||||
- for (i = 0; i < 8; i++) { |
||||
- switch (rdac_ptr->lun_table[k + i]) { |
||||
+ printf(" ALUA: %s\n", (rdac_ptr->options & 0x4 ? "Enabled" : "Disabled" )); |
||||
+ printf(" Force Quiescence: %s\n", (rdac_ptr->options & 0x2 ? "Enabled" : "Disabled" )); |
||||
+ printf (" LUN Table: (p = preferred, a = alternate, u = utm lun)\n"); |
||||
+ printf(" 0 1 2 3 4 5 6 7 8 9 a b c d e f\n"); |
||||
+ for (k = 0; k < lun_table_len; k += 16) { |
||||
+ printf(" 0x%x:",k / 16); |
||||
+ for (i = 0; i < 16; i++) { |
||||
+ switch (lun_table[k + i]) { |
||||
case 0x0: |
||||
printf(" x"); |
||||
break; |
||||
@@ -287,6 +373,9 @@ static void print_rdac_mode( unsigned char *ptr ) |
||||
printf(" ?"); |
||||
break; |
||||
} |
||||
+ if (i == 7) { |
||||
+ printf(" "); |
||||
+ } |
||||
} |
||||
printf("\n"); |
||||
} |
||||
@@ -296,6 +385,7 @@ static void usage() |
||||
{ |
||||
printf("Usage: sg_rdac [-a] [-f=LUN] [-v] [-V] DEVICE\n" |
||||
" where:\n" |
||||
+ " -6 use 6 byte cdbs for mode sense/select\n" |
||||
" -a transfer all devices to the controller\n" |
||||
" serving DEVICE.\n" |
||||
" -f=LUN transfer the device at LUN to the\n" |
||||
@@ -316,6 +406,7 @@ int main(int argc, char * argv[]) |
||||
int fail_all = 0; |
||||
int fail_path = 0; |
||||
int ret = 0; |
||||
+ int use_6_byte = 0; |
||||
|
||||
if (argc < 2) { |
||||
usage (); |
||||
@@ -333,6 +424,9 @@ int main(int argc, char * argv[]) |
||||
else if (!strcmp(*argptr, "-a")) { |
||||
++fail_all; |
||||
} |
||||
+ else if (!strcmp(*argptr, "-6")) { |
||||
+ use_6_byte = 1; |
||||
+ } |
||||
else if (!strcmp(*argptr, "-V")) { |
||||
fprintf(stderr, "sg_rdac version: %s\n", version_str); |
||||
return 0; |
||||
@@ -364,18 +458,24 @@ int main(int argc, char * argv[]) |
||||
} |
||||
|
||||
if (fail_all) { |
||||
- res = fail_all_paths(fd); |
||||
+ res = fail_all_paths(fd, use_6_byte); |
||||
} else if (fail_path) { |
||||
- res = fail_this_path(fd, lun); |
||||
+ res = fail_this_path(fd, lun, use_6_byte); |
||||
} else { |
||||
- res = sg_ll_mode_sense6(fd, /*DBD*/ 0, /* page control */0, |
||||
+ if (use_6_byte) { |
||||
+ res = sg_ll_mode_sense6(fd, /*DBD*/ 0, /* page control */0, |
||||
0x2c, 0, rsp_buff, 252, |
||||
1, do_verbose); |
||||
+ } else { |
||||
+ res = sg_ll_mode_sense10(fd, /*llbaa*/ 0, /*DBD*/ 0, /* page control */0, |
||||
+ 0x2c, 0x1, rsp_buff, 308, |
||||
+ 1, do_verbose); |
||||
+ } |
||||
|
||||
if (!res) { |
||||
if (do_verbose) |
||||
dump_mode_page(rsp_buff, rsp_buff[0]); |
||||
- print_rdac_mode(rsp_buff); |
||||
+ print_rdac_mode(rsp_buff, !use_6_byte); |
||||
} |
||||
} |
||||
ret = res; |
||||
diff --git a/src/sg_vpd_vendor.c b/src/sg_vpd_vendor.c |
||||
index 10d455a..45e2b9d 100644 |
||||
--- a/src/sg_vpd_vendor.c |
||||
+++ b/src/sg_vpd_vendor.c |
||||
@@ -89,20 +89,20 @@ static struct svpd_values_name_t vendor_vpd_pg[] = { |
||||
{VPD_V_DEV_BEH_SEA, 0, -1, 1, "devb", "Device behavior (Seagate)"}, |
||||
{VPD_V_EDID_RDAC, 0, -1, 1, "edid", "Extended device identification " |
||||
"(RDAC)"}, |
||||
- {VPD_V_FEAT_RDAC, 1, -1, 1, "feat", "Feature Parameters (RDAC)"}, |
||||
+ {VPD_V_FEAT_RDAC, 1, -1, 1, "prm4", "Feature Parameters (RDAC)"}, |
||||
{VPD_V_FIRM_SEA, 0, -1, 1, "firm", "Firmware numbers (Seagate)"}, |
||||
- {VPD_V_FVER_RDAC, 1, -1, 1, "fver", "Firmware version (RDAC)"}, |
||||
+ {VPD_V_FVER_RDAC, 1, -1, 1, "fwr4", "Firmware version (RDAC)"}, |
||||
{VPD_V_HP3PAR, 2, -1, 1, "hp3par", "Volume information (HP/3PAR)"}, |
||||
- {VPD_V_HVER_RDAC, 3, -1, 1, "hver", "Hardware version (RDAC)"}, |
||||
+ {VPD_V_HVER_RDAC, 3, -1, 1, "hwr4", "Hardware version (RDAC)"}, |
||||
{VPD_V_JUMP_SEA, 0, -1, 1, "jump", "Jump setting (Seagate)"}, |
||||
{VPD_V_RVSI_RDAC, 0, -1, 1, "rvsi", "Replicated volume source " |
||||
"identifier (RDAC)"}, |
||||
{VPD_V_SAID_RDAC, 0, -1, 1, "said", "Storage array world wide name " |
||||
"(RDAC)"}, |
||||
- {VPD_V_SUBS_RDAC, 0, -1, 1, "sub", "Subsystem identifier (RDAC)"}, |
||||
- {VPD_V_SVER_RDAC, 1, -1, 1, "sver", "Software version (RDAC)"}, |
||||
+ {VPD_V_SUBS_RDAC, 0, -1, 1, "subs", "Subsystem identifier (RDAC)"}, |
||||
+ {VPD_V_SVER_RDAC, 1, -1, 1, "swr4", "Software version (RDAC)"}, |
||||
{VPD_V_UPR_EMC, 1, -1, 1, "upr", "Unit path report (EMC)"}, |
||||
- {VPD_V_VAC_RDAC, 0, -1, 1, "vac", "Volume access control (RDAC)"}, |
||||
+ {VPD_V_VAC_RDAC, 0, -1, 1, "vac1", "Volume access control (RDAC)"}, |
||||
{0, 0, 0, 0, NULL, NULL}, |
||||
}; |
||||
|
||||
@@ -439,7 +439,7 @@ decode_rdac_vpd_c0(unsigned char * buff, int len) |
||||
memcpy(name, buff + 152, 2); |
||||
printf(" Board Revision: %s\n", name); |
||||
memset(name, 0, 65); |
||||
- memcpy(name, buff + 154, 2); |
||||
+ memcpy(name, buff + 154, 4); |
||||
printf(" Board Identifier: %s\n", name); |
||||
|
||||
return; |
||||
@@ -461,7 +461,7 @@ decode_rdac_vpd_c1(unsigned char * buff, int len) |
||||
"not possible.\n" , buff[4], buff[5], buff[6], buff[7]); |
||||
return; |
||||
} |
||||
- printf(" Firmware Version: %x.%x.%x\n", buff[8], buff[9], buff[10]); |
||||
+ printf(" Firmware Version: %02x.%02x.%02x\n", buff[8], buff[9], buff[10]); |
||||
printf(" Firmware Date: %02d/%02d/%02d\n", buff[11], buff[12], buff[13]); |
||||
|
||||
num_part = (len - 12) / 16; |
||||
@@ -504,7 +504,7 @@ decode_rdac_vpd_c2(unsigned char * buff, int len) |
||||
"not possible.\n" , buff[4], buff[5], buff[6], buff[7]); |
||||
return; |
||||
} |
||||
- printf(" Software Version: %x.%x.%x\n", buff[8], buff[9], buff[10]); |
||||
+ printf(" Software Version: %02x.%02x.%02x\n", buff[8], buff[9], buff[10]); |
||||
printf(" Software Date: %02d/%02d/%02d\n", buff[11], buff[12], buff[13]); |
||||
printf(" Features:"); |
||||
if (buff[14] & 0x01) |
||||
@@ -514,9 +514,9 @@ decode_rdac_vpd_c2(unsigned char * buff, int len) |
||||
if (buff[14] & 0x04) |
||||
printf(" Multiple Sub-enclosures,"); |
||||
if (buff[14] & 0x08) |
||||
- printf(" DCE/DRM,"); |
||||
+ printf(" DCE/DRM/DSS/DVE,"); |
||||
if (buff[14] & 0x10) |
||||
- printf(" AVT,"); |
||||
+ printf(" Asymmetric Logical Unit Access,"); |
||||
printf("\n"); |
||||
printf(" Max. #of LUNS: %d\n", buff[15]); |
||||
|
||||
@@ -562,6 +562,7 @@ decode_rdac_vpd_c3(unsigned char * buff, int len) |
||||
printf(" UTM: %s\n", buff[11] & 0x80?"enabled":"disabled"); |
||||
if ((buff[11] & 0x80)) |
||||
printf(" UTM LUN: %02x\n", buff[11] & 0x7f); |
||||
+ printf(" Persistent Reservations Bus Reset Support: %s\n", buff[12] & 0x01?"enabled":"disabled"); |
||||
|
||||
return; |
||||
} |
||||
@@ -603,6 +604,32 @@ decode_rdac_vpd_c4(unsigned char * buff, int len) |
||||
printf(" (Board ID 2880)\n"); |
||||
else if (!strcmp(subsystem_rev, "14.0")) |
||||
printf(" (Board ID 2822)\n"); |
||||
+ else if (!strcmp(subsystem_rev, "15.0")) |
||||
+ printf(" (Board ID 6091)\n"); |
||||
+ else if (!strcmp(subsystem_rev, "16.0")) |
||||
+ printf(" (Board ID 3992)\n"); |
||||
+ else if (!strcmp(subsystem_rev, "16.1")) |
||||
+ printf(" (Board ID 3991)\n"); |
||||
+ else if (!strcmp(subsystem_rev, "17.0")) |
||||
+ printf(" (Board ID 1331)\n"); |
||||
+ else if (!strcmp(subsystem_rev, "17.1")) |
||||
+ printf(" (Board ID 1332)\n"); |
||||
+ else if (!strcmp(subsystem_rev, "17.3")) |
||||
+ printf(" (Board ID 1532)\n"); |
||||
+ else if (!strcmp(subsystem_rev, "17.4")) |
||||
+ printf(" (Board ID 1932)\n"); |
||||
+ else if (!strcmp(subsystem_rev, "42.0")) |
||||
+ printf(" (Board ID 26x0)\n"); |
||||
+ else if (!strcmp(subsystem_rev, "43.0")) |
||||
+ printf(" (Board ID 498x)\n"); |
||||
+ else if (!strcmp(subsystem_rev, "44.0")) |
||||
+ printf(" (Board ID 548x)\n"); |
||||
+ else if (!strcmp(subsystem_rev, "45.0")) |
||||
+ printf(" (Board ID 5501)\n"); |
||||
+ else if (!strcmp(subsystem_rev, "46.0")) |
||||
+ printf(" (Board ID 2701)\n"); |
||||
+ else if (!strcmp(subsystem_rev, "47.0")) |
||||
+ printf(" (Board ID 5601)\n"); |
||||
else |
||||
printf(" (Board ID unknown)\n"); |
||||
|
||||
@@ -612,6 +639,16 @@ decode_rdac_vpd_c4(unsigned char * buff, int len) |
||||
} |
||||
|
||||
static void |
||||
+convert_binary_to_ascii(unsigned char * src, unsigned char * dst, int len) |
||||
+{ |
||||
+ int i; |
||||
+ |
||||
+ for (i = 0; i < len; i++) { |
||||
+ sprintf((char *)(dst+2*i), "%02x", *(src+i)); |
||||
+ } |
||||
+} |
||||
+ |
||||
+static void |
||||
decode_rdac_vpd_c8(unsigned char * buff, int len) |
||||
{ |
||||
int i; |
||||
@@ -623,6 +660,8 @@ decode_rdac_vpd_c8(unsigned char * buff, int len) |
||||
int label_len; |
||||
char uuid[33]; |
||||
int uuid_len; |
||||
+ unsigned char port_id[128]; |
||||
+ int n; |
||||
|
||||
if (len < 0xab) { |
||||
fprintf(stderr, "Extended Device Identification VPD page length too " |
||||
@@ -679,10 +718,110 @@ decode_rdac_vpd_c8(unsigned char * buff, int len) |
||||
|
||||
printf(" Logical Unit Number: %s\n", uuid); |
||||
|
||||
+ /* Initiator transport ID */ |
||||
+ if ( buff[10] & 0x01 ) { |
||||
+ memset(port_id, 0, 128); |
||||
+ printf(" Transport Protocol: "); |
||||
+ switch (buff[175] & 0x0F) { |
||||
+ case TPROTO_FCP: /* FC */ |
||||
+ printf("FC\n"); |
||||
+ convert_binary_to_ascii(&buff[183], port_id, 8); |
||||
+ n = 199; |
||||
+ break; |
||||
+ case TPROTO_SRP: /* SRP */ |
||||
+ printf("SRP\n"); |
||||
+ convert_binary_to_ascii(&buff[183], port_id, 8); |
||||
+ n = 199; |
||||
+ break; |
||||
+ case TPROTO_ISCSI: /* iSCSI */ |
||||
+ printf("iSCSI\n"); |
||||
+ n = (buff[177] << 8) + buff[178]; |
||||
+ memcpy(port_id, &buff[179], n); |
||||
+ n = 179 + n; |
||||
+ break; |
||||
+ case TPROTO_SAS: /* SAS */ |
||||
+ printf("SAS\n"); |
||||
+ convert_binary_to_ascii(&buff[179], port_id, 8); |
||||
+ n = 199; |
||||
+ break; |
||||
+ default: |
||||
+ return; /* Can't continue decoding, so return */ |
||||
+ } |
||||
+ |
||||
+ printf(" Initiator Port Identifier: %s\n", port_id); |
||||
+ if ( buff[10] & 0x02 ) { |
||||
+ memset(port_id, 0, 128); |
||||
+ memcpy(port_id, &buff[n], 8); |
||||
+ printf(" Supplemental Vendor ID: %s\n", port_id); |
||||
+ } |
||||
+ } |
||||
+ |
||||
return; |
||||
} |
||||
|
||||
static void |
||||
+decode_rdac_vpd_c9_rtpg_data(unsigned char aas, unsigned char vendor) |
||||
+{ |
||||
+ printf(" Asymmetric Access State:"); |
||||
+ switch(aas & 0x0F) { |
||||
+ case 0x0: |
||||
+ printf(" Active/Optimized"); |
||||
+ break; |
||||
+ case 0x1: |
||||
+ printf(" Active/Non-Optimized"); |
||||
+ break; |
||||
+ case 0x2: |
||||
+ printf(" Standby"); |
||||
+ break; |
||||
+ case 0x3: |
||||
+ printf(" Unavailable"); |
||||
+ break; |
||||
+ case 0xE: |
||||
+ printf(" Offline"); |
||||
+ break; |
||||
+ case 0xF: |
||||
+ printf(" Transitioning"); |
||||
+ break; |
||||
+ default: |
||||
+ printf(" (unknown)"); |
||||
+ break; |
||||
+ } |
||||
+ printf("\n"); |
||||
+ |
||||
+ printf(" Vendor Specific Field:"); |
||||
+ switch(vendor) { |
||||
+ case 0x01: |
||||
+ printf(" Operating normally"); |
||||
+ break; |
||||
+ case 0x02: |
||||
+ printf(" Non-responsive to queries"); |
||||
+ break; |
||||
+ case 0x03: |
||||
+ printf(" Controller being held in reset"); |
||||
+ break; |
||||
+ case 0x04: |
||||
+ printf(" Performing controller firmware download (1st controller)"); |
||||
+ break; |
||||
+ case 0x05: |
||||
+ printf(" Performing controller firmware download (2nd controller)"); |
||||
+ break; |
||||
+ case 0x06: |
||||
+ printf(" Quiesced as a result of an administrative request"); |
||||
+ break; |
||||
+ case 0x07: |
||||
+ printf(" Service mode as a result of an administrative request"); |
||||
+ break; |
||||
+ case 0xFF: |
||||
+ printf(" Details are not available"); |
||||
+ break; |
||||
+ default: |
||||
+ printf(" (unknown)"); |
||||
+ break; |
||||
+ } |
||||
+ printf("\n"); |
||||
+} |
||||
+ |
||||
+static void |
||||
decode_rdac_vpd_c9(unsigned char * buff, int len) |
||||
{ |
||||
if (len < 3) { |
||||
@@ -699,14 +838,18 @@ decode_rdac_vpd_c9(unsigned char * buff, int len) |
||||
fprintf(stderr, "Invalid page version '%c' (should be 1)\n", |
||||
buff[7]); |
||||
} |
||||
- printf(" AVT:"); |
||||
- if (buff[8] & 0x80) { |
||||
- printf(" Enabled"); |
||||
- if (buff[8] & 0x40) |
||||
- printf(" (Allow reads on sector 0)"); |
||||
- printf("\n"); |
||||
+ if ( (buff[8] & 0xE0) == 0xE0 ) { |
||||
+ printf(" IOShipping (ALUA): Enabled\n"); |
||||
} else { |
||||
- printf(" Disabled\n"); |
||||
+ printf(" AVT:"); |
||||
+ if (buff[8] & 0x80) { |
||||
+ printf(" Enabled"); |
||||
+ if (buff[8] & 0x40) |
||||
+ printf(" (Allow reads on sector 0)"); |
||||
+ printf("\n"); |
||||
+ } else { |
||||
+ printf(" Disabled\n"); |
||||
+ } |
||||
} |
||||
printf(" Volume Access via: "); |
||||
if (buff[8] & 0x01) |
||||
@@ -714,8 +857,54 @@ decode_rdac_vpd_c9(unsigned char * buff, int len) |
||||
else |
||||
printf("alternate controller\n"); |
||||
|
||||
- printf(" Path priority: %d ", buff[9] & 0xf); |
||||
- switch(buff[9] & 0xf) { |
||||
+ if (buff[8] & 0x08) { |
||||
+ printf(" Path priority: %d ", buff[15] & 0xf); |
||||
+ switch(buff[15] & 0xf) { |
||||
+ case 0x1: |
||||
+ printf("(preferred path)\n"); |
||||
+ break; |
||||
+ case 0x2: |
||||
+ printf("(secondary path)\n"); |
||||
+ break; |
||||
+ default: |
||||
+ printf("(unknown)\n"); |
||||
+ break; |
||||
+ } |
||||
+ |
||||
+ printf(" Preferred Path Auto Changeable:"); |
||||
+ switch(buff[14] & 0x3C) { |
||||
+ case 0x14: |
||||
+ printf(" No (User Disabled and Host Type Restricted)\n"); |
||||
+ break; |
||||
+ case 0x18: |
||||
+ printf(" No (User Disabled)\n"); |
||||
+ break; |
||||
+ case 0x24: |
||||
+ printf(" No (Host Type Restricted)\n"); |
||||
+ break; |
||||
+ case 0x28: |
||||
+ printf(" Yes\n"); |
||||
+ break; |
||||
+ default: |
||||
+ printf(" (Unknown)\n"); |
||||
+ break; |
||||
+ } |
||||
+ |
||||
+ printf(" Implicit Failback:"); |
||||
+ switch(buff[14] & 0x03) { |
||||
+ case 0x1: |
||||
+ printf(" Disabled\n"); |
||||
+ break; |
||||
+ case 0x2: |
||||
+ printf(" Enabled\n"); |
||||
+ break; |
||||
+ default: |
||||
+ printf(" (Unknown)\n"); |
||||
+ break; |
||||
+ } |
||||
+ } else { |
||||
+ printf(" Path priority: %d ", buff[9] & 0xf); |
||||
+ switch(buff[9] & 0xf) { |
||||
case 0x1: |
||||
printf("(preferred path)\n"); |
||||
break; |
||||
@@ -725,9 +914,17 @@ decode_rdac_vpd_c9(unsigned char * buff, int len) |
||||
default: |
||||
printf("(unknown)\n"); |
||||
break; |
||||
+ } |
||||
} |
||||
|
||||
- return; |
||||
+ |
||||
+ if (buff[8] & 0x80) { |
||||
+ printf(" Target Port Group Data (This controller):\n"); |
||||
+ decode_rdac_vpd_c9_rtpg_data(buff[10], buff[11]); |
||||
+ |
||||
+ printf(" Target Port Group Data (Alternate controller):\n"); |
||||
+ decode_rdac_vpd_c9_rtpg_data(buff[12], buff[13]); |
||||
+ } |
||||
} |
||||
|
||||
static void |
||||
-- |
||||
1.8.3.1 |
||||
|
@ -0,0 +1,115 @@
@@ -0,0 +1,115 @@
|
||||
From 9d2adc90e76e76c07ee63b2b2868579188fec1a7 Mon Sep 17 00:00:00 2001 |
||||
From: David Sommerseth <davids@redhat.com> |
||||
Date: Fri, 15 Apr 2016 23:53:18 +0200 |
||||
Subject: [PATCH] Fix /dev/null redirect mistakes |
||||
|
||||
Several places there are attempts to redirect to /dev/null, but |
||||
missing the redirect operator. This causes also /dev/null to be |
||||
deleted when running 'rescan-scsi-bus.sh -u'. |
||||
|
||||
Patch based on proposed patches in Red Hat bugzilla 1245302 |
||||
--- |
||||
scripts/rescan-scsi-bus.sh | 28 ++++++++++++++-------------- |
||||
1 file changed, 14 insertions(+), 14 deletions(-) |
||||
|
||||
diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh |
||||
index 7ec9323..4468cd3 100644 |
||||
--- a/scripts/rescan-scsi-bus.sh |
||||
+++ b/scripts/rescan-scsi-bus.sh |
||||
@@ -234,7 +234,7 @@ testonline () |
||||
if test ! -x /usr/bin/sg_turs; then return 0; fi |
||||
sgdevice |
||||
if test -z "$SGDEV"; then return 0; fi |
||||
- sg_turs /dev/$SGDEV >/dev/null 2>&1 |
||||
+ sg_turs /dev/$SGDEV &>/dev/null |
||||
RC=$? |
||||
# Handle in progress of becoming ready and unit attention -- wait at max 11s |
||||
declare -i ctr=0 |
||||
@@ -246,7 +246,7 @@ testonline () |
||||
if test $RC = 2 -a "$RMB" != "1"; then echo -n "."; let LN+=1; sleep 1 |
||||
else usleep 20000; fi |
||||
let ctr+=1 |
||||
- sg_turs /dev/$SGDEV >/dev/null 2>&1 |
||||
+ sg_turs /dev/$SGDEV &>/dev/null |
||||
RC=$? |
||||
done |
||||
if test $ctr != 0; then white_out; fi |
||||
@@ -703,7 +703,7 @@ findremapped() |
||||
# Trigger udev to update the info |
||||
echo -n "Triggering udev to update device information... " |
||||
/sbin/udevadm trigger |
||||
- udevadm_settle 2&>1 /dev/null |
||||
+ udevadm_settle &>/dev/null |
||||
echo "Done" |
||||
|
||||
# See what changed and reload the respective multipath device if applicable |
||||
@@ -724,12 +724,12 @@ findremapped() |
||||
incrchgd "$hctl" |
||||
fi |
||||
done < $tmpfile |
||||
- rm $tmpfile 2&>1 /dev/null |
||||
+ rm $tmpfile &>/dev/null |
||||
|
||||
if test -n "$mp_enable" -a -n "$mpaths" ; then |
||||
echo "Updating multipath device mappings" |
||||
flushmpaths |
||||
- $MULTIPATH | grep "create:" 2> /dev/null #2&>1 /dev/null |
||||
+ $MULTIPATH | grep "create:" 2> /dev/null |
||||
fi |
||||
} |
||||
|
||||
@@ -831,14 +831,14 @@ reloadmpaths() |
||||
|
||||
if [ "$1" = "1" ] ; then |
||||
echo "Reloading all multipath devices" |
||||
- $MULTIPATH -r 2&>1 /dev/null |
||||
+ $MULTIPATH -r &>/dev/null |
||||
return |
||||
fi |
||||
|
||||
# Reload the multipath devices |
||||
for mpath in $mpaths ; do |
||||
echo "Reloading multipath device $mpath" |
||||
- $MULTIPATH -r $mpath 2&>1 /dev/null |
||||
+ $MULTIPATH -r $mpath &>/dev/null |
||||
done |
||||
} |
||||
|
||||
@@ -851,9 +851,9 @@ flushmpaths() |
||||
num=$($DMSETUP status $mpath | awk 'BEGIN{RS=" ";active=0}/[0-9]+:[0-9]+/{dev=1}/A/{if (dev == 1) active++; dev=0} END{ print active }') |
||||
if [ $num -eq 0 ] ; then |
||||
echo -n "Flushing multipath device $mpath... " |
||||
- $DMSETUP message $mpath 0 fail_if_no_path 2&>1 /dev/null |
||||
- $MULTIPATH -f $mpath 2&>1 /dev/null |
||||
- $DMSETUP status $mpath 2&>1 /dev/null |
||||
+ $DMSETUP message $mpath 0 fail_if_no_path &>/dev/null |
||||
+ $MULTIPATH -f $mpath &>/dev/null |
||||
+ $DMSETUP status $mpath &>/dev/null |
||||
if test "$?" = "1" ; then |
||||
echo "Done" |
||||
else |
||||
@@ -866,9 +866,9 @@ flushmpaths() |
||||
# Flush all the devs specified in $mpaths |
||||
for mpath in $mpaths ; do |
||||
echo -n "Flushing multipath device $mpath... " |
||||
- $DMSETUP message $mpath 0 fail_if_no_path 2&>1 /dev/null |
||||
- $MULTIPATH -f $mpath 2&>1 /dev/null |
||||
- $DMSETUP status $mpath 2&>1 /dev/null |
||||
+ $DMSETUP message $mpath 0 fail_if_no_path &>/dev/null |
||||
+ $MULTIPATH -f $mpath &>/dev/null |
||||
+ $DMSETUP status $mpath &>/dev/null |
||||
if test "$?" = "1" ; then |
||||
echo "Done" |
||||
else |
||||
@@ -967,7 +967,7 @@ if test ! -d /sys/class/scsi_host/ -a ! -d /proc/scsi/; then |
||||
fi |
||||
|
||||
# Make sure sg is there |
||||
-modprobe sg >/dev/null 2>&1 |
||||
+modprobe sg &>/dev/null |
||||
|
||||
if test -x /usr/bin/sg_inq; then |
||||
sg_version=$(sg_inq -V 2>&1 | cut -d " " -f 3) |
||||
-- |
||||
1.8.3.1 |
||||
|
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
commit 9a2c94700471486dd6487b7659762a41f7ee33c7 |
||||
Author: David Sommerseth <davids@redhat.com> |
||||
Date: Fri Apr 15 20:31:32 2016 +0200 |
||||
|
||||
Fix issues with multi word device types |
||||
|
||||
When running rescan-scsi-bus.sh on systems with device types such |
||||
as "Medium Changer" or "Optical Device", the following error can be |
||||
observed: |
||||
|
||||
/usr/bin/rescan-scsi-bus.sh: line 281: [: too many arguments |
||||
|
||||
Signed-off-by: David Sommerseth <davids@redhat.com> |
||||
|
||||
diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh |
||||
old mode 100755 |
||||
new mode 100644 |
||||
index 81112c1..7ec9323 |
||||
--- a/scripts/rescan-scsi-bus.sh |
||||
+++ b/scripts/rescan-scsi-bus.sh |
||||
@@ -278,7 +278,9 @@ testonline () |
||||
return 1 |
||||
fi |
||||
TMPSTR=`echo "$SCSISTR" | sed -n 's/.*Type: *\(.*\) *ANSI.*/\1/p'` |
||||
- if [ $TMPSTR != $TYPE ] ; then |
||||
+ NTMPSTR="$(sed -e 's/[[:space:]]*$//' -e 's/^[[:space:]]*//' <<<${TMPSTR})" |
||||
+ NTYPE="$(sed -e 's/[[:space:]]*$//' -e 's/^[[:space:]]*//' <<<${TYPE})" |
||||
+ if [ "$NTMPSTR" != "$NTYPE" ] ; then |
||||
echo -e "\e[A\e[A\e[A\e[A${red}$SGDEV changed: ${bold}\nfrom:${TMPSTR} \nto: $TYPE ${norm} \n\n\n" |
||||
return 1 |
||||
fi |
@ -0,0 +1,29 @@
@@ -0,0 +1,29 @@
|
||||
From e946e403b434d27c88dc7819fb3589419cdfd954 Mon Sep 17 00:00:00 2001 |
||||
From: David Sommerseth <davids@redhat.com> |
||||
Date: Fri, 22 Apr 2016 18:58:08 +0200 |
||||
Subject: [PATCH] Fix syntax error in if-statement related to mpath flush |
||||
operation |
||||
|
||||
Without this patch, the error "[-x: command not found" would be seen |
||||
when running 'rescan-scsi-bus.sh -f' on a system with multipath support |
||||
packages installed. |
||||
--- |
||||
scripts/rescan-scsi-bus.sh | 2 +- |
||||
1 file changed, 1 insertion(+), 1 deletion(-) |
||||
|
||||
diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh |
||||
index 4468cd3..caa031f 100644 |
||||
--- a/scripts/rescan-scsi-bus.sh |
||||
+++ b/scripts/rescan-scsi-bus.sh |
||||
@@ -1090,7 +1090,7 @@ declare -i updated=0 |
||||
declare -i rmvd=0 |
||||
|
||||
if [ -n "$flush" ] ; then |
||||
- if [-x $MULTIPATH ] ; then |
||||
+ if [ -x $MULTIPATH ] ; then |
||||
flushmpaths 1 |
||||
fi |
||||
fi |
||||
-- |
||||
1.8.3.1 |
||||
|
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
diff -Nur sg3_utils-1.37_old/scripts/rescan-scsi-bus.sh sg3_utils-1.37/scripts/rescan-scsi-bus.sh |
||||
--- sg3_utils-1.37_old/scripts/rescan-scsi-bus.sh 2017-03-14 14:45:43.312032787 +0800 |
||||
+++ sg3_utils-1.37/scripts/rescan-scsi-bus.sh 2017-03-14 14:47:06.997039234 +0800 |
||||
@@ -964,8 +964,8 @@ |
||||
echo "--issue-lip: same as -i" |
||||
echo "--wide: same as -w" |
||||
echo "--multipath: same as -m" |
||||
- echo "--forcerescan: Rescan existing devices" |
||||
- echo "--forceremove: Remove and readd every device (DANGEROUS)" |
||||
+ echo "--forceremove: Remove stale devices (DANGEROUS)" |
||||
+ echo "--forcerescan: Remove and readd existing devices (DANGEROUS)" |
||||
echo "--nooptscan: don't stop looking for LUNs if 0 is not found" |
||||
echo "--color: use coloured prefixes OLD/NEW/DEL" |
||||
echo "--hosts=LIST: Scan only host(s) in LIST" |
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
From c387f9de93750a04380f068803ce9da340cf45f5 Mon Sep 17 00:00:00 2001 |
||||
From: Sebastian Parschauer <sparschauer@suse.de> |
||||
Date: Wed, 31 Aug 2016 15:34:23 +0200 |
||||
Subject: [PATCH] rescan-scsi-bus.sh: Add lunsearch filter to searchexisting() |
||||
|
||||
A user has reported that `rescan-scsi-bus.sh --luns=<lun #>` prints |
||||
all existing LUNs and scans all new LUNs instead of only the ones |
||||
specified. The problem is that searchexisting() always calls |
||||
doreportlun() and is missing the lunsearch filter e.g. used in |
||||
dosearch(). |
||||
So add the required lunsearch filter from dosearch() to |
||||
searchexisting(). |
||||
|
||||
References: bsc#981452 |
||||
|
||||
Signed-off-by: Sebastian Parschauer <sparschauer@suse.de> |
||||
--- |
||||
scripts/rescan-scsi-bus.sh | 11 ++++++++++- |
||||
1 file changed, 10 insertions(+), 1 deletion(-) |
||||
|
||||
diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh |
||||
index 5f43d6d..1f957b0 100755 |
||||
--- a/scripts/rescan-scsi-bus.sh |
||||
+++ b/scripts/rescan-scsi-bus.sh |
||||
@@ -715,7 +715,16 @@ searchexisting() |
||||
else |
||||
match=1 |
||||
fi |
||||
- test $match -eq 1 && doreportlun |
||||
+ |
||||
+ test $match -eq 0 && continue |
||||
+ |
||||
+ if [ -z "$lunsearch" ] ; then |
||||
+ doreportlun |
||||
+ else |
||||
+ for lun in $lunsearch ; do |
||||
+ dolunscan |
||||
+ done |
||||
+ fi |
||||
done |
||||
} |
||||
|
||||
-- |
||||
2.12.0 |
||||
|
@ -0,0 +1,93 @@
@@ -0,0 +1,93 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.2. |
||||
.TH RESCAN-SCSI-BUS.SH "1" "leden 2014" "rescan-scsi-bus.sh 1.57" "User Commands" |
||||
.SH NAME |
||||
rescan-scsi-bus.sh \- script for adding and removing SCSI devices without rebooting |
||||
.SH SYNOPSIS |
||||
.B rescan-scsi-bus.sh |
||||
[\fIoptions\fR] [\fIhost \fR[\fIhost \fR...]] |
||||
.SH OPTIONS |
||||
.TP |
||||
\fB\-a\fR, \fB\-\-alltargets\fR |
||||
scan all targets, not just currently existing [default: disabled] |
||||
.TP |
||||
\fB\-d\fR |
||||
enable debug [default: 0] |
||||
.TP |
||||
\fB\-l\fR |
||||
activates scanning for LUNs 0\-\-7 [default: 0] |
||||
.TP |
||||
\fB\-L\fR NUM |
||||
activates scanning for LUNs 0\-\-NUM [default: 0] |
||||
.TP |
||||
\fB\-w\fR, \fB\-\-wide\fR |
||||
scan for target device IDs 0\-\-15 [default: 0\-\-7] |
||||
.TP |
||||
\fB\-c\fR |
||||
enables scanning of channels 0 1 [default: 0 / all detected ones] |
||||
.TP |
||||
\fB\-r\fR, \fB\-\-remove\fR |
||||
enables removing of devices [default: disabled] |
||||
.TP |
||||
\fB\-f\fR, \fB\-\-flush\fR |
||||
flush failed multipath devices [default: disabled] |
||||
.TP |
||||
\fB\-i\fR, \fB\-\-issue\-lip\fR |
||||
issue a FibreChannel LIP reset [default: disabled] |
||||
.TP |
||||
\fB\-m\fR, \fB\-\-multipath\fR |
||||
update multipath devices [default: disabled] |
||||
.TP |
||||
\fB\-u\fR, \fB\-\-update\fR |
||||
look for existing disks that have been remapped |
||||
.TP |
||||
\fB\-s\fR, \fB\-\-resize\fR |
||||
look for resized disks and reload associated multipath devices, if applicable |
||||
.TP |
||||
\fB\-\-forcerescan\fR |
||||
remove and readd existing devices (DANGEROUS) |
||||
.TP |
||||
\fB\-\-forceremove\fR |
||||
remove stale devices (DANGEROUS) |
||||
.TP |
||||
\fB\-\-nooptscan\fR |
||||
don't stop looking for LUNs if 0 is not found |
||||
.TP |
||||
\fB\-\-color\fR |
||||
use coloured prefixes OLD/NEW/DEL |
||||
.TP |
||||
\fB\-\-hosts\fR=\fILIST\fR |
||||
scan only host(s) in \fILIST\fR |
||||
.TP |
||||
\fB\-\-channels\fR=\fILIST\fR |
||||
scan only channel(s) in \fILIST\fR |
||||
.TP |
||||
\fB\-\-ids\fR=\fILIST\fR |
||||
scan only target ID(s) in \fILIST\fR |
||||
.TP |
||||
\fB\-\-luns\fR=\fILIST\fR |
||||
scan only lun(s) in \fILIST\fR |
||||
.TP |
||||
\fB\-\-sync\fR, \fB\-\-nosync\fR |
||||
issue a sync / no sync [default: sync if remove] |
||||
.TP |
||||
\fB\-\-attachpq3\fR |
||||
tell kernel to attach sg to LUN 0 that reports PQ=3 |
||||
.TP |
||||
\fB\-\-reportlun2\fR |
||||
tell kernel to try REPORT_LUN even on SCSI2 devices |
||||
.TP |
||||
\fB\-\-largelun\fR |
||||
tell kernel to support LUNs > 7 even on SCSI2 devs |
||||
.TP |
||||
\fB\-\-sparselun\fR |
||||
tell kernel to support sparse LUN numbering |
||||
.IP |
||||
Host numbers may thus be specified either directly on cmd line (deprecated) or |
||||
or with the \fB\-\-hosts\fR=\fILIST\fR parameter (recommended). |
||||
.PP |
||||
\fILIST\fR: A[\-B][,C[\-D]]... is a comma separated list of single values and ranges |
||||
(No spaces allowed.) |
||||
.SH SEE ALSO |
||||
\fBrescan-scsi-bus.sh\fR Homepage: \fBhttp://www.garloff.de/kurt/linux/#rescan-scsi\fR |
||||
.PP |
||||
\fBsg3_utils\fR Homepage: \fBhttp://sg.danny.cz/sg\fR |
@ -0,0 +1,27 @@
@@ -0,0 +1,27 @@
|
||||
From a0569d83929d98c0a175bc3992352c2c8d09ffa4 Mon Sep 17 00:00:00 2001 |
||||
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz> |
||||
Date: Fri, 18 Oct 2013 12:38:05 +0200 |
||||
Subject: [PATCH] don't open /dev/snapshot in sginfo (#920687) |
||||
|
||||
see https://bugzilla.redhat.com/show_bug.cgi?id=920687 for details |
||||
--- |
||||
src/sginfo.c | 3 +++ |
||||
1 file changed, 3 insertions(+) |
||||
|
||||
diff --git a/src/sginfo.c b/src/sginfo.c |
||||
index b27f117..1f2151d 100644 |
||||
--- a/src/sginfo.c |
||||
+++ b/src/sginfo.c |
||||
@@ -3408,6 +3408,9 @@ show_devices(int raw) |
||||
if ( isdigit(entry->d_name[strlen(entry->d_name)-1]) ) { |
||||
continue; |
||||
} |
||||
+ if ( strncmp("snapshot",entry->d_name,8) == 0 ) { |
||||
+ continue; |
||||
+ } |
||||
|
||||
snprintf(dev_name, sizeof(dev_name),"/dev/%s",entry->d_name); |
||||
|
||||
-- |
||||
1.8.1.4 |
||||
|
@ -0,0 +1,95 @@
@@ -0,0 +1,95 @@
|
||||
From 1653f314de9f0a0415259f2182bf65a745537f33 Mon Sep 17 00:00:00 2001 |
||||
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz> |
||||
Date: Tue, 28 Jan 2014 14:15:56 +0100 |
||||
Subject: [PATCH] remove duplicit words in man pages |
||||
|
||||
--- |
||||
doc/sg3_utils.8 | 2 +- |
||||
doc/sg_format.8 | 2 +- |
||||
doc/sg_get_lba_status.8 | 2 +- |
||||
doc/sg_ses.8 | 2 +- |
||||
doc/sg_stpg.8 | 2 +- |
||||
doc/sginfo.8 | 2 +- |
||||
6 files changed, 6 insertions(+), 6 deletions(-) |
||||
|
||||
diff --git a/doc/sg3_utils.8 b/doc/sg3_utils.8 |
||||
index ae9b181..d295eeb 100644 |
||||
--- a/doc/sg3_utils.8 |
||||
+++ b/doc/sg3_utils.8 |
||||
@@ -146,7 +146,7 @@ drives and "cd" for SCSI CD/DVD/BD drives. Each SCSI device has a |
||||
corresponding pass\-through device name of the form /dev/pass<num> |
||||
where <num> is an integer starting at zero. The "camcontrol devlist" |
||||
command may be useful for finding out which SCSI device names are |
||||
-available and the correspondence between between class and pass\-through |
||||
+available and the correspondence between class and pass\-through |
||||
names. |
||||
.SH SOLARIS DEVICE NAMING |
||||
SCSI device names below the /dev directory have a form like: c5t4d3s2 |
||||
diff --git a/doc/sg_format.8 b/doc/sg_format.8 |
||||
index 4cf4e82..055ff04 100644 |
||||
--- a/doc/sg_format.8 |
||||
+++ b/doc/sg_format.8 |
||||
@@ -265,7 +265,7 @@ protection type of a disk can be found in the "P_TYPE" and "PROT_EN" |
||||
fields in the response of a READ CAPACITY (16) command (e.g. with |
||||
the 'sg_readcap \-\-long' utility). |
||||
.PP |
||||
-Given that a device supports a particular protection type, a user can then |
||||
+Given that a device supports a particular protection type, a user can |
||||
then choose to format that disk with that protection type by setting |
||||
the "FMTPINFO" and "Protection Field Usage" fields in the FORMAT UNIT |
||||
command. Those fields correspond to the \fI\-\-fmtpinfo=FPI\fR and the |
||||
diff --git a/doc/sg_get_lba_status.8 b/doc/sg_get_lba_status.8 |
||||
index ab8269c..bbb0c09 100644 |
||||
--- a/doc/sg_get_lba_status.8 |
||||
+++ b/doc/sg_get_lba_status.8 |
||||
@@ -28,7 +28,7 @@ when use once then one LBA status descriptor per line is output to stdout. |
||||
Each line has this |
||||
format: "0x<descriptor_LBA> 0x<blocks> <provisioning_status>". So the |
||||
descriptor LBA and blocks are output in hex and the provisioning status |
||||
-in decimal. When used twice (e.g. '\-bb' or '\-\-brief \-\-brief') the |
||||
+in decimal. When used twice (e.g. '\-bb' or '\-\-brief \-\-brief') |
||||
the provisioning status of the given \fILBA\fR (or LBA 0 if the |
||||
\fI\-\-lba\fR option is not given) is output to stdout. A check is made |
||||
that the given \fILBA\fR lies on the range of the first returned LBA |
||||
diff --git a/doc/sg_ses.8 b/doc/sg_ses.8 |
||||
index 1cd71c5..a94fe48 100644 |
||||
--- a/doc/sg_ses.8 |
||||
+++ b/doc/sg_ses.8 |
||||
@@ -237,7 +237,7 @@ given. |
||||
.PP |
||||
One of two command lines variants can be used to specify indexes: |
||||
\fI\-\-index=TIA,II\fR where \fITIA\fR is either an type header index (TI) |
||||
-or an Element type abbreviation (A) (e.g. "ps" or "ps1"). \fIII\fR is |
||||
+or an Element type abbreviation (A) (e.g. "ps" or "ps1"). \fIII\fR |
||||
is either an individual index or "\-1" to specify the overall element. The |
||||
second variant is \fI\-\-index=IIA\fR where \fIIIA\fR is either an individual |
||||
index (II) or an Element type abbreviation (A). When \fIIIA\fR is an |
||||
diff --git a/doc/sg_stpg.8 b/doc/sg_stpg.8 |
||||
index f93f029..8ab6b1a 100644 |
||||
--- a/doc/sg_stpg.8 |
||||
+++ b/doc/sg_stpg.8 |
||||
@@ -104,7 +104,7 @@ identifier (i.e. acts on one or more target ports). |
||||
When \fI\-\-tp=\fR is given then the same number of elements should be |
||||
given to the \fI\-\-state=\fR option. If more than one list element is |
||||
given to \fI\-\-tp=\fR and an equal number of elements is _not_ given |
||||
-to the the \fI\-\-state=\fR option, then if only one state is specified |
||||
+to the \fI\-\-state=\fR option, then if only one state is specified |
||||
then it is repeated. |
||||
.SH EXIT STATUS |
||||
The exit status of sg_stpg is 0 when it is successful. Otherwise see |
||||
diff --git a/doc/sginfo.8 b/doc/sginfo.8 |
||||
index 8d570b1..7abff65 100644 |
||||
--- a/doc/sginfo.8 |
||||
+++ b/doc/sginfo.8 |
||||
@@ -287,7 +287,7 @@ hex (mode page index in the first column and the corresponding byte |
||||
value in the second column) use "\-u 0xa". Mode pages (subpage code == 0) |
||||
start at index position 2 while subpages start at index position 4. |
||||
If the "\-Xu ..." option is used then a list a hex values each value |
||||
-prefixed by "@" is output. Mode (sub)page values can then be modified with |
||||
+prefixed by "@" is output. Mode (sub)page values can then be modified |
||||
with the "\-RXu ..." option. |
||||
.PP |
||||
.SH RESTRICTIONS |
||||
-- |
||||
1.8.1.4 |
||||
|
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
diff -urNp sg3_utils-1.37-orig/scripts/rescan-scsi-bus.sh sg3_utils-1.37-new/scripts/rescan-scsi-bus.sh |
||||
--- sg3_utils-1.37-orig/scripts/rescan-scsi-bus.sh 2016-07-19 15:49:36.401733259 +0200 |
||||
+++ sg3_utils-1.37-new/scripts/rescan-scsi-bus.sh 2016-07-19 15:54:35.719136146 +0200 |
||||
@@ -929,6 +929,7 @@ if test @$1 = @--help -o @$1 = @-h -o @$ |
||||
echo " -L NUM activates scanning for LUNs 0--NUM [default: 0]" |
||||
echo " -w scan for target device IDs 0--15 [default: 0--7]" |
||||
echo " -c enables scanning of channels 0 1 [default: 0 / all detected ones]" |
||||
+ echo " -m update multipath devices [default: disabled]" |
||||
echo " -r enables removing of devices [default: disabled]" |
||||
echo " -f flush failed multipath devices [default: disabled]" |
||||
echo " -i issue a FibreChannel LIP reset [default: disabled]" |
||||
@@ -939,6 +940,7 @@ if test @$1 = @--help -o @$1 = @-h -o @$ |
||||
echo "--flush: same as -f" |
||||
echo "--issue-lip: same as -i" |
||||
echo "--wide: same as -w" |
||||
+ echo "--multipath: same as -m" |
||||
echo "--forcerescan: Rescan existing devices" |
||||
echo "--forceremove: Remove and readd every device (DANGEROUS)" |
||||
echo "--nooptscan: don't stop looking for LUNs if 0 is not found" |
@ -0,0 +1,12 @@
@@ -0,0 +1,12 @@
|
||||
diff -urNp sg3_utils-1.37-orig/scripts/rescan-scsi-bus.sh sg3_utils-1.37-new/scripts/rescan-scsi-bus.sh |
||||
--- sg3_utils-1.37-orig/scripts/rescan-scsi-bus.sh 2016-07-14 15:22:26.268711185 +0200 |
||||
+++ sg3_utils-1.37-new/scripts/rescan-scsi-bus.sh 2016-07-14 15:18:50.443651936 +0200 |
||||
@@ -941,7 +941,7 @@ if test @$1 = @--help -o @$1 = @-h -o @$ |
||||
echo "--wide: same as -w" |
||||
echo "--forcerescan: Rescan existing devices" |
||||
echo "--forceremove: Remove and readd every device (DANGEROUS)" |
||||
- echo "--nooptscan: don't stop looking for LUNs is 0 is not found" |
||||
+ echo "--nooptscan: don't stop looking for LUNs if 0 is not found" |
||||
echo "--color: use coloured prefixes OLD/NEW/DEL" |
||||
echo "--hosts=LIST: Scan only host(s) in LIST" |
||||
echo "--channels=LIST: Scan only channel(s) in LIST" |
@ -0,0 +1,46 @@
@@ -0,0 +1,46 @@
|
||||
diff --git a/doc/sg_rdac.8 b/doc/sg_rdac.8 |
||||
index 8e3d27a..cac0776 100644 |
||||
--- a/doc/sg_rdac.8 |
||||
+++ b/doc/sg_rdac.8 |
||||
@@ -19,6 +19,8 @@ Transfer all (visible) devices |
||||
\fB\-f\fR=\fILUN\fR |
||||
Transfer the device identified by \fILUN\fR. This command will only work |
||||
if the controller supports 'Dual Active Mode' (aka active/active mode). |
||||
+\fILUN\fR is a decimal number which cannot exceed 31 when the \fI\-6\fR |
||||
+option is given, otherwise is cannot exceed 255. |
||||
.TP |
||||
\fB\-v\fR |
||||
be verbose |
||||
@@ -33,7 +35,7 @@ Written by Hannes Reinecke <hare at suse dot com>, based on sg_emc_trespass. |
||||
.SH "REPORTING BUGS" |
||||
Report bugs to <dgilbert at interlog dot com>. |
||||
.SH COPYRIGHT |
||||
-Copyright \(co 2006\-2012 Hannes Reinecke, Douglas Gilbert. |
||||
+Copyright \(co 2006\-2016 Hannes Reinecke, Douglas Gilbert. |
||||
.br |
||||
This software is distributed under the GPL version 2. There is NO |
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||
diff --git a/src/sg_rdac.c b/src/sg_rdac.c |
||||
index ea243a2..63cfe46 100644 |
||||
--- a/src/sg_rdac.c |
||||
+++ b/src/sg_rdac.c |
||||
@@ -188,9 +188,16 @@ static int fail_this_path(int fd, int lun, int use_6_byte) |
||||
struct rdac_page_common *rdac_common = NULL; |
||||
int res; |
||||
|
||||
- if (use_6_byte && lun > 32) { |
||||
- fprintf(stderr, "must use 10 byte cdb to fail luns over 32\n"); |
||||
- return -1; |
||||
+ if (use_6_byte) { |
||||
+ if (lun > 31) { |
||||
+ fprintf(stderr, "must use 10 byte cdb to fail luns over 31\n"); |
||||
+ return -1; |
||||
+ } |
||||
+ } else { /* 10 byte cdb case */ |
||||
+ if (lun > 255) { |
||||
+ fprintf(stderr, "lun cannot exceed 255\n"); |
||||
+ return -1; |
||||
+ } |
||||
} |
||||
|
||||
memset(fail_paths_pg, 0, 308); |
@ -0,0 +1,362 @@
@@ -0,0 +1,362 @@
|
||||
%global rescan_script rescan-scsi-bus.sh |
||||
|
||||
Summary: Utilities for devices that use SCSI command sets |
||||
Name: sg3_utils |
||||
Version: 1.37 |
||||
Release: 12%{?dist} |
||||
License: GPLv2+ and BSD |
||||
Group: Applications/System |
||||
Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tgz |
||||
Source1: rescan-scsi-bus.sh.8 |
||||
Source2: scsi-rescan.8 |
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=920687 |
||||
Patch0: sg3_utils-1.37-dont-open-dev-snapshot.patch |
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=948463 |
||||
Patch1: sg3_utils-1.37-man-pages-fix.patch |
||||
Patch2: 0001-Fix-issues-with-multi-word-device-types.patch |
||||
Patch3: 0001-Fix-dev-null-redirect-mistakes.patch |
||||
Patch4: 0001-Fix-syntax-error-in-if-statement-related-to-mpath-fl.patch |
||||
Patch5: 0001-Add-upstream-updates-to-sg_inq-sg_rdac-and-sg_vpd.patch |
||||
Patch6: sg_rdac_additional_upstream_fixes.patch |
||||
#fix typo in nooptscan option in rescan scsi bus script (#1353941) |
||||
Patch7: sg3_utils-1.37-rescan-scsi-typo.patch |
||||
#document -m/--multipath option in rescan-scsi-bus.sh script (#1357851) |
||||
Patch8: sg3_utils-1.37-rescan-scsi-missingoption.patch |
||||
Patch9: BZ_1380744-rescan-scsi-bus.sh-Add-lunsearch-filter-to-searchexi.patch |
||||
Patch10: BZ_1360915-rescan-scsi-bus.sh-Fixup-help-text-for-forcerescan.patch |
||||
URL: http://sg.danny.cz/sg/sg3_utils.html |
||||
Requires: %{name}-libs = %{version}-%{release} |
||||
|
||||
|
||||
%description |
||||
Collection of Linux utilities for devices that use the SCSI command set. |
||||
Includes utilities to copy data based on "dd" syntax and semantics (called |
||||
sg_dd, sgp_dd and sgm_dd); check INQUIRY data and VPD pages (sg_inq); check |
||||
mode and log pages (sginfo, sg_modes and sg_logs); spin up and down |
||||
disks (sg_start); do self tests (sg_senddiag); and various other functions. |
||||
See the README, CHANGELOG and COVERAGE files. Requires the linux kernel 2.4 |
||||
series or later. In the 2.4 series SCSI generic device names (e.g. /dev/sg0) |
||||
must be used. In the 2.6 series other device names may be used as |
||||
well (e.g. /dev/sda). |
||||
|
||||
Warning: Some of these tools access the internals of your system |
||||
and the incorrect usage of them may render your system inoperable. |
||||
|
||||
%package libs |
||||
Summary: Shared library for %{name} |
||||
Group: System Environment/Libraries |
||||
|
||||
%description libs |
||||
This package contains the shared library for %{name}. |
||||
|
||||
%package devel |
||||
Summary: Development library and header files for the sg3_utils library |
||||
Group: Development/Libraries |
||||
Requires: %{name}-libs = %{version}-%{release} |
||||
Requires: glibc-headers |
||||
|
||||
%description devel |
||||
This package contains the %{name} library and its header files for |
||||
developing applications. |
||||
|
||||
%prep |
||||
%setup -q |
||||
%patch0 -p1 -b .dev-snapshot |
||||
%patch1 -p1 -b .man-fixes |
||||
%patch2 -p1 -b .mwdevtype |
||||
%patch3 -p1 -b .rmdevnullfix |
||||
%patch4 -p1 -b .mpathsyntaxerr |
||||
%patch5 -p1 -b .upstream1 |
||||
%patch6 -p1 -b .upstream2 |
||||
%patch7 -p1 -b .typo |
||||
%patch8 -p1 -b .missingopt |
||||
%patch9 -p1 -b .rescan_all_lun |
||||
%patch10 -p1 -b .help_forcerescan_forceremove |
||||
|
||||
%build |
||||
%configure --disable-static |
||||
|
||||
# Don't use rpath! |
||||
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool |
||||
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool |
||||
|
||||
make %{?_smp_mflags} |
||||
|
||||
|
||||
%install |
||||
make install DESTDIR=$RPM_BUILD_ROOT |
||||
rm -rf $RPM_BUILD_ROOT/%{_libdir}/*.la |
||||
|
||||
install -p -m 755 scripts/%{rescan_script} $RPM_BUILD_ROOT%{_bindir} |
||||
( cd $RPM_BUILD_ROOT%{_bindir}; ln -sf %{rescan_script} scsi-rescan ) |
||||
|
||||
install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_mandir}/man8 |
||||
install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man8 |
||||
|
||||
|
||||
%post libs -p /sbin/ldconfig |
||||
|
||||
%postun libs -p /sbin/ldconfig |
||||
|
||||
|
||||
%files |
||||
%doc AUTHORS BSD_LICENSE COPYING COVERAGE CREDITS ChangeLog README README.sg_start |
||||
%{_bindir}/* |
||||
%{_mandir}/man8/* |
||||
|
||||
%files libs |
||||
%doc BSD_LICENSE COPYING |
||||
%{_libdir}/*.so.* |
||||
|
||||
%files devel |
||||
%{_includedir}/scsi/*.h |
||||
%{_libdir}/*.so |
||||
|
||||
|
||||
%changelog |
||||
* Wed May 10 2017 Gris Ge <fge@redhat.com> 1.37-12 |
||||
- Fix the manpage of `forceremove` and `forcerescan` command. |
||||
(RHBZ #1360915) |
||||
|
||||
* Tue Mar 14 2017 Gris Ge <fge@redhat.com> - 1.37-11 |
||||
- Fix the help message of `forceremove` and `forcerescan` command. |
||||
(RHBZ #1360915) |
||||
|
||||
* Tue Mar 07 2017 Gris Ge <fge@redhat.com> - 1.37-10 |
||||
- Fix rescan-scsi-bus.sh for scan all luns. (RHBZ #1380744) |
||||
|
||||
* Tue Jul 19 2016 Ondrej Vasik <ovasik@redhat.com> - 1.37-9 |
||||
- rescan-scsi-bus.sh: document -m/--multipath option (#1357851) |
||||
|
||||
* Thu Jul 14 2016 Josef Ridky <jridky@redhat.com> - 1.37-8 |
||||
- rescan-scsi-bus.sh: fix typo in help and man page (#1353941) |
||||
|
||||
* Fri Apr 15 2016 David Sommerseth <davids@redhat.com> - 1.37-7 |
||||
- Avoid deletion of /dev/null (#1298737) |
||||
- Fix syntax error in rescan-scsi-bus related to multipath flushing (#1255564) |
||||
- Add upstream updates to sg_inq, sg_rdac and sg_vpd (#1170719) |
||||
|
||||
* Fri Apr 15 2016 David Sommerseth <davids@redhat.com> - 1.37-6 |
||||
- Fix error appearing on device types described with multiple words (#1298739) |
||||
|
||||
* Wed Jan 29 2014 Dan Horák <dan@danny.cz> - 1.37-5 |
||||
- fix various man pages (#948463) |
||||
- add man page for the rescan-scsi-bus.sh script (#948463) |
||||
- Resolves: #948463 |
||||
|
||||
* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 1.37-4 |
||||
- Mass rebuild 2014-01-24 |
||||
|
||||
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 1.37-3 |
||||
- Mass rebuild 2013-12-27 |
||||
|
||||
* Fri Oct 18 2013 Dan Horák <dan@danny.cz> - 1.37-2 |
||||
- include fix for #920687 |
||||
|
||||
* Wed Oct 16 2013 Dan Horák <dan@danny.cz> - 1.37-1 |
||||
- update to version 1.37 |
||||
- switch to included rescan-scsi-bus script |
||||
|
||||
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.36-2 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild |
||||
|
||||
* Thu Jun 06 2013 Dan Horák <dan@danny.cz> - 1.36-1 |
||||
- update to version 1.36 |
||||
- modernize spec |
||||
|
||||
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.35-2 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild |
||||
|
||||
* Mon Jan 21 2013 Dan Horák <dan@danny.cz> - 1.35-1 |
||||
- update to version 1.35 |
||||
|
||||
* Thu Oct 18 2012 Dan Horák <dan@danny.cz> - 1.34-1 |
||||
- update to version 1.34 |
||||
|
||||
* Fri Sep 14 2012 Dan Horák <dan@danny.cz> - 1.33-4 |
||||
- add fix for sg3_utils >= 1.32 to the rescan-scsi-bus script |
||||
|
||||
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.33-3 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild |
||||
|
||||
* Wed Apr 4 2012 Dan Horák <dan@danny.cz> - 1.33-2 |
||||
- include rescan-scsi-bus script 1.56 |
||||
|
||||
* Tue Apr 3 2012 Dan Horák <dan@danny.cz> - 1.33-1 |
||||
- update to version 1.33 |
||||
|
||||
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.31-2 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild |
||||
|
||||
* Fri Feb 18 2011 Dan Horák <dan@danny.cz> - 1.31-1 |
||||
- update to version 1.31 |
||||
|
||||
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.29-3 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild |
||||
|
||||
* Thu Jul 8 2010 Dan Horák <dan@danny.cz> - 1.29-2 |
||||
- added license texts into -libs subpackage |
||||
|
||||
* Mon Apr 12 2010 Dan Horák <dan@danny.cz> - 1.29-1 |
||||
- update to version 1.29 |
||||
|
||||
* Thu Jan 14 2010 Dan Horák <dan@danny.cz> - 1.28-2 |
||||
- include rescan-scsi-bus script 1.35 |
||||
- rebase patches and add fix for issue mentioned in #538787 |
||||
|
||||
* Thu Oct 22 2009 Dan Horák <dan@danny.cz> - 1.28-1 |
||||
- update to version 1.28 |
||||
- added fixes from RHEL to rescan-scsi-bus.sh |
||||
- added scsi-rescan symlink to the rescan-scsi-bus.sh script |
||||
|
||||
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.27-2 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild |
||||
|
||||
* Tue Apr 28 2009 Dan Horák <dan@danny.cz> - 1.27-1 |
||||
- update to version 1.27 |
||||
- changelog: http://sg.danny.cz/sg/p/sg3_utils.ChangeLog |
||||
|
||||
* Tue Mar 31 2009 Dan Horák <dan@danny.cz> - 1.26-4 |
||||
- add dependency between the libs subpackage and the main package (#492921) |
||||
|
||||
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.26-3 |
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild |
||||
|
||||
* Mon Nov 3 2008 Dan Horák <dan@danny.cz> - 1.26-2 |
||||
- update URL |
||||
- include rescan-scsi-bus script 1.29 |
||||
|
||||
* Mon Jun 30 2008 Dan Horák <dan@danny.cz> - 1.26-1 |
||||
- update to upstream version 1.26 |
||||
|
||||
* Fri Mar 28 2008 Phil Knirsch <pknirsch@redhat.com> - 1.25-4 |
||||
- Dropped really unnecessary Provides of sg_utils (#226414) |
||||
- Use --disable-static in configure (#226414) |
||||
|
||||
* Thu Mar 27 2008 Phil Knirsch <pknirsch@redhat.com> - 1.25-3 |
||||
- Specfile cleanup, removal of static development libraries (#226414) |
||||
|
||||
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.25-2 |
||||
- Autorebuild for GCC 4.3 |
||||
|
||||
* Mon Oct 22 2007 Phil Knirsch <pknirsch@redhat.com> - 1.25-1 |
||||
- Fixed URLs |
||||
- Updated to sg3_utils-1.25 |
||||
|
||||
* Thu Aug 16 2007 Phil Knirsch <pknirsch@redhat.com> - 1.23-2 |
||||
- License review and update |
||||
|
||||
* Fri Feb 02 2007 Phil Knirsch <pknirsch@redhat.com> - 1.23-1 |
||||
- Update to sg3_utils-1.23 |
||||
- Updated summary |
||||
|
||||
* Mon Nov 13 2006 Phil Knirsch <pknirsch@redhat.com> - 1.22-1 |
||||
- Update to sg3_utils-1.22 |
||||
|
||||
* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 1.20-2.1 |
||||
- rebuild |
||||
|
||||
* Wed Jun 07 2006 Phil Knirsch <pknirsch@redhat.com> - 1.20-2 |
||||
- Fixed rebuild problem on latest toolchain |
||||
- Added missing buildprereqs |
||||
|
||||
* Fri May 19 2006 Phil Knirsch <pknirsch@redhat.com> - 1.20-1 |
||||
- Update to sg3_utils-1.20. |
||||
|
||||
* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 1.19-1.1 |
||||
- bump again for double-long bug on ppc(64) |
||||
|
||||
* Fri Feb 10 2006 Phil Knirsch <pknirsch@redhat.com> - 1.19-1 |
||||
- Update to sg3_utils-1.19. |
||||
- Fixed rebuild problem on 64bit archs. |
||||
|
||||
* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 1.17-1.1 |
||||
- rebuilt for new gcc4.1 snapshot and glibc changes |
||||
|
||||
* Mon Nov 07 2005 Phil Knirsch <pknirsch@redhat.com> 1.17-1 |
||||
- Update to sg3-utils-1.17 |
||||
- Split package up into 3 subpackages: sg3_utils, devel and libs |
||||
- Some minor updates to the specfile |
||||
|
||||
* Wed Mar 02 2005 Phil Knirsch <pknirsch@redhat.com> 1.06-5 |
||||
- bump release and rebuild with gcc 4 |
||||
|
||||
* Fri Feb 18 2005 Phil Knirsch <pknirsch@redhat.com> 1.06-4 |
||||
- rebuilt |
||||
|
||||
* Tue Aug 03 2004 Phil Knirsch <pknirsch@redhat.com> 1.06-3 |
||||
- rebuilt |
||||
|
||||
* Thu Mar 11 2004 Tim Powers <timp@redhat.com> 1.06-2 |
||||
- rebuild |
||||
|
||||
* Wed Feb 18 2004 Phil Knirsch <pknirsch@redhat.com> 1.06-1 |
||||
- Initial version for RHEL3 U2. |
||||
|
||||
* Fri Jan 09 2004 - dgilbert@interlog.com |
||||
- sg3_utils.spec for mandrake; more sginfo work, sg_scan, sg_logs |
||||
* sg3_utils-1.06 |
||||
|
||||
* Wed Nov 12 2003 - dgilbert@interlog.com |
||||
- sg_readcap: sizes; sg_logs: double fetch; sg_map 256 sg devices; sginfo |
||||
* sg3_utils-1.05 |
||||
|
||||
* Tue May 13 2003 - dgilbert@interlog.com |
||||
- default sg_turs '-n=' to 1, sg_logs gets '-t' for temperature, CREDITS |
||||
* sg3_utils-1.04 |
||||
|
||||
* Wed Apr 02 2003 - dgilbert@interlog.com |
||||
- 6 byte CDBs for sg_modes, sg_start on block devs, sg_senddiag, man pages |
||||
* sg3_utils-1.03 |
||||
|
||||
* Wed Jan 01 2003 - dgilbert@interlog.com |
||||
- interwork with block SG_IO, fix in sginfo, '-t' for sg_turs |
||||
* sg3_utils-1.02 |
||||
|
||||
* Wed Aug 14 2002 - dgilbert@interlog.com |
||||
- raw switch in sg_inq |
||||
* sg3_utils-1.01 |
||||
|
||||
* Sun Jul 28 2002 - dgilbert@interlog.com |
||||
- decode sg_logs pages, add dio to sgm_dd, drop "gen=1" arg, "of=/dev/null" |
||||
* sg3_utils-1.00 |
||||
|
||||
* Sun Mar 17 2002 - dgilbert@interlog.com |
||||
- add sg_modes+sg_logs for sense pages, expand sg_inq, add fua+sync to sg_dd++ |
||||
* sg3_utils-0.99 |
||||
|
||||
* Sat Feb 16 2002 - dgilbert@interlog.com |
||||
- resurrect sg_reset; snprintf cleanup, time,gen+cdbsz args to sg_dd++ |
||||
* sg3_utils-0.98 |
||||
|
||||
* Sun Dec 23 2001 - dgilbert@interlog.com |
||||
- move isosize to archive directory; now found in util-linux-2.10s and later |
||||
* sg3_utils-0.97 |
||||
|
||||
* Fri Dec 21 2001 - dgilbert@interlog.com |
||||
- add sgm_dd, sg_read, sg_simple4 and sg_simple16 [add mmap-ed IO support] |
||||
* sg3_utils-0.96 |
||||
|
||||
* Sat Sep 15 2001 - dgilbert@interlog.com |
||||
- sg_map can do inquiry; sg_dd, sgp_dd + sgq_dd dio help |
||||
* sg3_utils-0.95 |
||||
|
||||
* Thu Apr 19 2001 - dgilbert@interlog.com |
||||
- add sg_start, improve sginfo and sg_map [Kurt Garloff] |
||||
* sg3_utils-0.94 |
||||
|
||||
* Mon Mar 5 2001 - dgilbert@interlog.com |
||||
- add scsi_devfs_scan, add sg_include.h, 'coe' more general in sgp_dd |
||||
* sg3_utils-0.93 |
||||
|
||||
* Tue Jan 16 2001 - dgilbert@interlog.com |
||||
- clean sg_err.h include dependencies, bug fixes, Makefile in archive directory |
||||
* sg3_utils-0.92 |
||||
|
||||
* Thu Dec 21 2000 - dgilbert@interlog.com |
||||
- signals for sg_dd, man pages and additions for sg_rbuf and isosize |
||||
* sg3_utils-0.91 |
||||
|
||||
* Mon Dec 11 2000 - dgilbert@interlog.com |
||||
- Initial creation of package, containing |
||||
* sg3_utils-0.90 |
Loading…
Reference in new issue