diff options
Diffstat (limited to 'drivers/target/target_core_pr.c')
-rw-r--r-- | drivers/target/target_core_pr.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 429ad7291664..b7c779389eea 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
@@ -478,6 +478,7 @@ static int core_scsi3_pr_seq_non_holder( | |||
478 | case READ_MEDIA_SERIAL_NUMBER: | 478 | case READ_MEDIA_SERIAL_NUMBER: |
479 | case REPORT_LUNS: | 479 | case REPORT_LUNS: |
480 | case REQUEST_SENSE: | 480 | case REQUEST_SENSE: |
481 | case PERSISTENT_RESERVE_IN: | ||
481 | ret = 0; /*/ Allowed CDBs */ | 482 | ret = 0; /*/ Allowed CDBs */ |
482 | break; | 483 | break; |
483 | default: | 484 | default: |
@@ -1534,7 +1535,7 @@ static int core_scsi3_decode_spec_i_port( | |||
1534 | tidh_new->dest_local_nexus = 1; | 1535 | tidh_new->dest_local_nexus = 1; |
1535 | list_add_tail(&tidh_new->dest_list, &tid_dest_list); | 1536 | list_add_tail(&tidh_new->dest_list, &tid_dest_list); |
1536 | 1537 | ||
1537 | buf = transport_kmap_first_data_page(cmd); | 1538 | buf = transport_kmap_data_sg(cmd); |
1538 | /* | 1539 | /* |
1539 | * For a PERSISTENT RESERVE OUT specify initiator ports payload, | 1540 | * For a PERSISTENT RESERVE OUT specify initiator ports payload, |
1540 | * first extract TransportID Parameter Data Length, and make sure | 1541 | * first extract TransportID Parameter Data Length, and make sure |
@@ -1785,7 +1786,7 @@ static int core_scsi3_decode_spec_i_port( | |||
1785 | 1786 | ||
1786 | } | 1787 | } |
1787 | 1788 | ||
1788 | transport_kunmap_first_data_page(cmd); | 1789 | transport_kunmap_data_sg(cmd); |
1789 | 1790 | ||
1790 | /* | 1791 | /* |
1791 | * Go ahead and create a registrations from tid_dest_list for the | 1792 | * Go ahead and create a registrations from tid_dest_list for the |
@@ -1833,7 +1834,7 @@ static int core_scsi3_decode_spec_i_port( | |||
1833 | 1834 | ||
1834 | return 0; | 1835 | return 0; |
1835 | out: | 1836 | out: |
1836 | transport_kunmap_first_data_page(cmd); | 1837 | transport_kunmap_data_sg(cmd); |
1837 | /* | 1838 | /* |
1838 | * For the failure case, release everything from tid_dest_list | 1839 | * For the failure case, release everything from tid_dest_list |
1839 | * including *dest_pr_reg and the configfs dependances.. | 1840 | * including *dest_pr_reg and the configfs dependances.. |
@@ -3120,7 +3121,7 @@ static int core_scsi3_pro_preempt( | |||
3120 | if (!calling_it_nexus) | 3121 | if (!calling_it_nexus) |
3121 | core_scsi3_ua_allocate(pr_reg_nacl, | 3122 | core_scsi3_ua_allocate(pr_reg_nacl, |
3122 | pr_res_mapped_lun, 0x2A, | 3123 | pr_res_mapped_lun, 0x2A, |
3123 | ASCQ_2AH_RESERVATIONS_PREEMPTED); | 3124 | ASCQ_2AH_REGISTRATIONS_PREEMPTED); |
3124 | } | 3125 | } |
3125 | spin_unlock(&pr_tmpl->registration_lock); | 3126 | spin_unlock(&pr_tmpl->registration_lock); |
3126 | /* | 3127 | /* |
@@ -3233,7 +3234,7 @@ static int core_scsi3_pro_preempt( | |||
3233 | * additional sense code set to REGISTRATIONS PREEMPTED; | 3234 | * additional sense code set to REGISTRATIONS PREEMPTED; |
3234 | */ | 3235 | */ |
3235 | core_scsi3_ua_allocate(pr_reg_nacl, pr_res_mapped_lun, 0x2A, | 3236 | core_scsi3_ua_allocate(pr_reg_nacl, pr_res_mapped_lun, 0x2A, |
3236 | ASCQ_2AH_RESERVATIONS_PREEMPTED); | 3237 | ASCQ_2AH_REGISTRATIONS_PREEMPTED); |
3237 | } | 3238 | } |
3238 | spin_unlock(&pr_tmpl->registration_lock); | 3239 | spin_unlock(&pr_tmpl->registration_lock); |
3239 | /* | 3240 | /* |
@@ -3410,14 +3411,14 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
3410 | * will be moved to for the TransportID containing SCSI initiator WWN | 3411 | * will be moved to for the TransportID containing SCSI initiator WWN |
3411 | * information. | 3412 | * information. |
3412 | */ | 3413 | */ |
3413 | buf = transport_kmap_first_data_page(cmd); | 3414 | buf = transport_kmap_data_sg(cmd); |
3414 | rtpi = (buf[18] & 0xff) << 8; | 3415 | rtpi = (buf[18] & 0xff) << 8; |
3415 | rtpi |= buf[19] & 0xff; | 3416 | rtpi |= buf[19] & 0xff; |
3416 | tid_len = (buf[20] & 0xff) << 24; | 3417 | tid_len = (buf[20] & 0xff) << 24; |
3417 | tid_len |= (buf[21] & 0xff) << 16; | 3418 | tid_len |= (buf[21] & 0xff) << 16; |
3418 | tid_len |= (buf[22] & 0xff) << 8; | 3419 | tid_len |= (buf[22] & 0xff) << 8; |
3419 | tid_len |= buf[23] & 0xff; | 3420 | tid_len |= buf[23] & 0xff; |
3420 | transport_kunmap_first_data_page(cmd); | 3421 | transport_kunmap_data_sg(cmd); |
3421 | buf = NULL; | 3422 | buf = NULL; |
3422 | 3423 | ||
3423 | if ((tid_len + 24) != cmd->data_length) { | 3424 | if ((tid_len + 24) != cmd->data_length) { |
@@ -3469,7 +3470,7 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
3469 | return -EINVAL; | 3470 | return -EINVAL; |
3470 | } | 3471 | } |
3471 | 3472 | ||
3472 | buf = transport_kmap_first_data_page(cmd); | 3473 | buf = transport_kmap_data_sg(cmd); |
3473 | proto_ident = (buf[24] & 0x0f); | 3474 | proto_ident = (buf[24] & 0x0f); |
3474 | #if 0 | 3475 | #if 0 |
3475 | pr_debug("SPC-3 PR REGISTER_AND_MOVE: Extracted Protocol Identifier:" | 3476 | pr_debug("SPC-3 PR REGISTER_AND_MOVE: Extracted Protocol Identifier:" |
@@ -3503,7 +3504,7 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
3503 | goto out; | 3504 | goto out; |
3504 | } | 3505 | } |
3505 | 3506 | ||
3506 | transport_kunmap_first_data_page(cmd); | 3507 | transport_kunmap_data_sg(cmd); |
3507 | buf = NULL; | 3508 | buf = NULL; |
3508 | 3509 | ||
3509 | pr_debug("SPC-3 PR [%s] Extracted initiator %s identifier: %s" | 3510 | pr_debug("SPC-3 PR [%s] Extracted initiator %s identifier: %s" |
@@ -3768,13 +3769,13 @@ after_iport_check: | |||
3768 | " REGISTER_AND_MOVE\n"); | 3769 | " REGISTER_AND_MOVE\n"); |
3769 | } | 3770 | } |
3770 | 3771 | ||
3771 | transport_kunmap_first_data_page(cmd); | 3772 | transport_kunmap_data_sg(cmd); |
3772 | 3773 | ||
3773 | core_scsi3_put_pr_reg(dest_pr_reg); | 3774 | core_scsi3_put_pr_reg(dest_pr_reg); |
3774 | return 0; | 3775 | return 0; |
3775 | out: | 3776 | out: |
3776 | if (buf) | 3777 | if (buf) |
3777 | transport_kunmap_first_data_page(cmd); | 3778 | transport_kunmap_data_sg(cmd); |
3778 | if (dest_se_deve) | 3779 | if (dest_se_deve) |
3779 | core_scsi3_lunacl_undepend_item(dest_se_deve); | 3780 | core_scsi3_lunacl_undepend_item(dest_se_deve); |
3780 | if (dest_node_acl) | 3781 | if (dest_node_acl) |
@@ -3848,7 +3849,7 @@ int target_scsi3_emulate_pr_out(struct se_task *task) | |||
3848 | scope = (cdb[2] & 0xf0); | 3849 | scope = (cdb[2] & 0xf0); |
3849 | type = (cdb[2] & 0x0f); | 3850 | type = (cdb[2] & 0x0f); |
3850 | 3851 | ||
3851 | buf = transport_kmap_first_data_page(cmd); | 3852 | buf = transport_kmap_data_sg(cmd); |
3852 | /* | 3853 | /* |
3853 | * From PERSISTENT_RESERVE_OUT parameter list (payload) | 3854 | * From PERSISTENT_RESERVE_OUT parameter list (payload) |
3854 | */ | 3855 | */ |
@@ -3866,7 +3867,7 @@ int target_scsi3_emulate_pr_out(struct se_task *task) | |||
3866 | aptpl = (buf[17] & 0x01); | 3867 | aptpl = (buf[17] & 0x01); |
3867 | unreg = (buf[17] & 0x02); | 3868 | unreg = (buf[17] & 0x02); |
3868 | } | 3869 | } |
3869 | transport_kunmap_first_data_page(cmd); | 3870 | transport_kunmap_data_sg(cmd); |
3870 | buf = NULL; | 3871 | buf = NULL; |
3871 | 3872 | ||
3872 | /* | 3873 | /* |
@@ -3966,7 +3967,7 @@ static int core_scsi3_pri_read_keys(struct se_cmd *cmd) | |||
3966 | return -EINVAL; | 3967 | return -EINVAL; |
3967 | } | 3968 | } |
3968 | 3969 | ||
3969 | buf = transport_kmap_first_data_page(cmd); | 3970 | buf = transport_kmap_data_sg(cmd); |
3970 | buf[0] = ((su_dev->t10_pr.pr_generation >> 24) & 0xff); | 3971 | buf[0] = ((su_dev->t10_pr.pr_generation >> 24) & 0xff); |
3971 | buf[1] = ((su_dev->t10_pr.pr_generation >> 16) & 0xff); | 3972 | buf[1] = ((su_dev->t10_pr.pr_generation >> 16) & 0xff); |
3972 | buf[2] = ((su_dev->t10_pr.pr_generation >> 8) & 0xff); | 3973 | buf[2] = ((su_dev->t10_pr.pr_generation >> 8) & 0xff); |
@@ -4000,7 +4001,7 @@ static int core_scsi3_pri_read_keys(struct se_cmd *cmd) | |||
4000 | buf[6] = ((add_len >> 8) & 0xff); | 4001 | buf[6] = ((add_len >> 8) & 0xff); |
4001 | buf[7] = (add_len & 0xff); | 4002 | buf[7] = (add_len & 0xff); |
4002 | 4003 | ||
4003 | transport_kunmap_first_data_page(cmd); | 4004 | transport_kunmap_data_sg(cmd); |
4004 | 4005 | ||
4005 | return 0; | 4006 | return 0; |
4006 | } | 4007 | } |
@@ -4026,7 +4027,7 @@ static int core_scsi3_pri_read_reservation(struct se_cmd *cmd) | |||
4026 | return -EINVAL; | 4027 | return -EINVAL; |
4027 | } | 4028 | } |
4028 | 4029 | ||
4029 | buf = transport_kmap_first_data_page(cmd); | 4030 | buf = transport_kmap_data_sg(cmd); |
4030 | buf[0] = ((su_dev->t10_pr.pr_generation >> 24) & 0xff); | 4031 | buf[0] = ((su_dev->t10_pr.pr_generation >> 24) & 0xff); |
4031 | buf[1] = ((su_dev->t10_pr.pr_generation >> 16) & 0xff); | 4032 | buf[1] = ((su_dev->t10_pr.pr_generation >> 16) & 0xff); |
4032 | buf[2] = ((su_dev->t10_pr.pr_generation >> 8) & 0xff); | 4033 | buf[2] = ((su_dev->t10_pr.pr_generation >> 8) & 0xff); |
@@ -4085,7 +4086,7 @@ static int core_scsi3_pri_read_reservation(struct se_cmd *cmd) | |||
4085 | 4086 | ||
4086 | err: | 4087 | err: |
4087 | spin_unlock(&se_dev->dev_reservation_lock); | 4088 | spin_unlock(&se_dev->dev_reservation_lock); |
4088 | transport_kunmap_first_data_page(cmd); | 4089 | transport_kunmap_data_sg(cmd); |
4089 | 4090 | ||
4090 | return 0; | 4091 | return 0; |
4091 | } | 4092 | } |
@@ -4109,7 +4110,7 @@ static int core_scsi3_pri_report_capabilities(struct se_cmd *cmd) | |||
4109 | return -EINVAL; | 4110 | return -EINVAL; |
4110 | } | 4111 | } |
4111 | 4112 | ||
4112 | buf = transport_kmap_first_data_page(cmd); | 4113 | buf = transport_kmap_data_sg(cmd); |
4113 | 4114 | ||
4114 | buf[0] = ((add_len << 8) & 0xff); | 4115 | buf[0] = ((add_len << 8) & 0xff); |
4115 | buf[1] = (add_len & 0xff); | 4116 | buf[1] = (add_len & 0xff); |
@@ -4141,7 +4142,7 @@ static int core_scsi3_pri_report_capabilities(struct se_cmd *cmd) | |||
4141 | buf[4] |= 0x02; /* PR_TYPE_WRITE_EXCLUSIVE */ | 4142 | buf[4] |= 0x02; /* PR_TYPE_WRITE_EXCLUSIVE */ |
4142 | buf[5] |= 0x01; /* PR_TYPE_EXCLUSIVE_ACCESS_ALLREG */ | 4143 | buf[5] |= 0x01; /* PR_TYPE_EXCLUSIVE_ACCESS_ALLREG */ |
4143 | 4144 | ||
4144 | transport_kunmap_first_data_page(cmd); | 4145 | transport_kunmap_data_sg(cmd); |
4145 | 4146 | ||
4146 | return 0; | 4147 | return 0; |
4147 | } | 4148 | } |
@@ -4171,7 +4172,7 @@ static int core_scsi3_pri_read_full_status(struct se_cmd *cmd) | |||
4171 | return -EINVAL; | 4172 | return -EINVAL; |
4172 | } | 4173 | } |
4173 | 4174 | ||
4174 | buf = transport_kmap_first_data_page(cmd); | 4175 | buf = transport_kmap_data_sg(cmd); |
4175 | 4176 | ||
4176 | buf[0] = ((su_dev->t10_pr.pr_generation >> 24) & 0xff); | 4177 | buf[0] = ((su_dev->t10_pr.pr_generation >> 24) & 0xff); |
4177 | buf[1] = ((su_dev->t10_pr.pr_generation >> 16) & 0xff); | 4178 | buf[1] = ((su_dev->t10_pr.pr_generation >> 16) & 0xff); |
@@ -4292,7 +4293,7 @@ static int core_scsi3_pri_read_full_status(struct se_cmd *cmd) | |||
4292 | buf[6] = ((add_len >> 8) & 0xff); | 4293 | buf[6] = ((add_len >> 8) & 0xff); |
4293 | buf[7] = (add_len & 0xff); | 4294 | buf[7] = (add_len & 0xff); |
4294 | 4295 | ||
4295 | transport_kunmap_first_data_page(cmd); | 4296 | transport_kunmap_data_sg(cmd); |
4296 | 4297 | ||
4297 | return 0; | 4298 | return 0; |
4298 | } | 4299 | } |