diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-05-17 00:52:10 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-05-17 03:45:58 -0400 |
commit | ba539743b70cd160c84bab1c82910d0789b820f8 (patch) | |
tree | dfcd54b96116920512e58301e682ffeec7c8f1ff /drivers/target | |
parent | 66246617ab7f0587f42ca49825a16d7a391fe15b (diff) |
target: Fix MAINTENANCE_IN service action CDB checks to use lower 5 bits
This patch fixes the MAINTENANCE_IN service action type checks to only
look at the proper lower 5 bits of cdb byte 1. This addresses the case
where MI_REPORT_TARGET_PGS w/ extended header using the upper three bits of
cdb byte 1 was not processed correctly in transport_generic_cmd_sequencer,
as well as the three cases for standby, unavailable, and transition ALUA
primary access state checks.
Also add MAINTENANCE_IN to the excluded list in transport_generic_prepare_cdb()
to prevent the PARAMETER DATA FORMAT bits from being cleared.
Cc: Hannes Reinecke <hare@suse.de>
Cc: Rob Evers <revers@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_alua.c | 6 | ||||
-rw-r--r-- | drivers/target/target_core_transport.c | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c index c39ae7cd9895..be7251ee8b3a 100644 --- a/drivers/target/target_core_alua.c +++ b/drivers/target/target_core_alua.c | |||
@@ -387,7 +387,7 @@ static inline int core_alua_state_standby( | |||
387 | case RECEIVE_DIAGNOSTIC: | 387 | case RECEIVE_DIAGNOSTIC: |
388 | case SEND_DIAGNOSTIC: | 388 | case SEND_DIAGNOSTIC: |
389 | case MAINTENANCE_IN: | 389 | case MAINTENANCE_IN: |
390 | switch (cdb[1]) { | 390 | switch (cdb[1] & 0x1f) { |
391 | case MI_REPORT_TARGET_PGS: | 391 | case MI_REPORT_TARGET_PGS: |
392 | return 0; | 392 | return 0; |
393 | default: | 393 | default: |
@@ -429,7 +429,7 @@ static inline int core_alua_state_unavailable( | |||
429 | case INQUIRY: | 429 | case INQUIRY: |
430 | case REPORT_LUNS: | 430 | case REPORT_LUNS: |
431 | case MAINTENANCE_IN: | 431 | case MAINTENANCE_IN: |
432 | switch (cdb[1]) { | 432 | switch (cdb[1] & 0x1f) { |
433 | case MI_REPORT_TARGET_PGS: | 433 | case MI_REPORT_TARGET_PGS: |
434 | return 0; | 434 | return 0; |
435 | default: | 435 | default: |
@@ -469,7 +469,7 @@ static inline int core_alua_state_transition( | |||
469 | case INQUIRY: | 469 | case INQUIRY: |
470 | case REPORT_LUNS: | 470 | case REPORT_LUNS: |
471 | case MAINTENANCE_IN: | 471 | case MAINTENANCE_IN: |
472 | switch (cdb[1]) { | 472 | switch (cdb[1] & 0x1f) { |
473 | case MI_REPORT_TARGET_PGS: | 473 | case MI_REPORT_TARGET_PGS: |
474 | return 0; | 474 | return 0; |
475 | default: | 475 | default: |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 2a34d0e4c24c..f95a74da4d40 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -1329,6 +1329,7 @@ static inline void transport_generic_prepare_cdb( | |||
1329 | case VERIFY_16: /* SBC - VRProtect */ | 1329 | case VERIFY_16: /* SBC - VRProtect */ |
1330 | case WRITE_VERIFY: /* SBC - VRProtect */ | 1330 | case WRITE_VERIFY: /* SBC - VRProtect */ |
1331 | case WRITE_VERIFY_12: /* SBC - VRProtect */ | 1331 | case WRITE_VERIFY_12: /* SBC - VRProtect */ |
1332 | case MAINTENANCE_IN: /* SPC - Parameter Data Format for SA RTPG */ | ||
1332 | break; | 1333 | break; |
1333 | default: | 1334 | default: |
1334 | cdb[1] &= 0x1f; /* clear logical unit number */ | 1335 | cdb[1] &= 0x1f; /* clear logical unit number */ |
@@ -2597,7 +2598,7 @@ static int transport_generic_cmd_sequencer( | |||
2597 | /* | 2598 | /* |
2598 | * Check for emulated MI_REPORT_TARGET_PGS. | 2599 | * Check for emulated MI_REPORT_TARGET_PGS. |
2599 | */ | 2600 | */ |
2600 | if (cdb[1] == MI_REPORT_TARGET_PGS && | 2601 | if ((cdb[1] & 0x1f) == MI_REPORT_TARGET_PGS && |
2601 | su_dev->t10_alua.alua_type == SPC3_ALUA_EMULATED) { | 2602 | su_dev->t10_alua.alua_type == SPC3_ALUA_EMULATED) { |
2602 | cmd->execute_cmd = | 2603 | cmd->execute_cmd = |
2603 | target_emulate_report_target_port_groups; | 2604 | target_emulate_report_target_port_groups; |