Commit 3e2deba7 authored by Dmitry Bogdanov's avatar Dmitry Bogdanov Committed by Martin K. Petersen

scsi: target: core: New key must be used for moved PR

According to SPC4 5.12.8:

  e) Retain the reservation key specified in the SERVICE ACTION RESERVATION
  KEY field and associated information;

But currently sa_res_key is only used for the not existing I_T nexus. Add a
changing of the key for the existing I_T nexus the PR moved to.

Link: https://lore.kernel.org/r/20220909090425.14479-5-d.bogdanov@yadro.comReviewed-by: default avatarMike Christie <michael.christie@oracle.com>
Signed-off-by: default avatarDmitry Bogdanov <d.bogdanov@yadro.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 49790e6a
...@@ -3440,8 +3440,6 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key, ...@@ -3440,8 +3440,6 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key,
* transport protocols where port names are not required; * transport protocols where port names are not required;
* d) Register the reservation key specified in the SERVICE ACTION * d) Register the reservation key specified in the SERVICE ACTION
* RESERVATION KEY field; * RESERVATION KEY field;
* e) Retain the reservation key specified in the SERVICE ACTION
* RESERVATION KEY field and associated information;
* *
* Also, It is not an error for a REGISTER AND MOVE service action to * Also, It is not an error for a REGISTER AND MOVE service action to
* register an I_T nexus that is already registered with the same * register an I_T nexus that is already registered with the same
...@@ -3463,6 +3461,12 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key, ...@@ -3463,6 +3461,12 @@ core_scsi3_emulate_pro_register_and_move(struct se_cmd *cmd, u64 res_key,
dest_pr_reg = __core_scsi3_locate_pr_reg(dev, dest_node_acl, dest_pr_reg = __core_scsi3_locate_pr_reg(dev, dest_node_acl,
iport_ptr); iport_ptr);
new_reg = 1; new_reg = 1;
} else {
/*
* e) Retain the reservation key specified in the SERVICE ACTION
* RESERVATION KEY field and associated information;
*/
dest_pr_reg->pr_res_key = sa_res_key;
} }
/* /*
* f) Release the persistent reservation for the persistent reservation * f) Release the persistent reservation for the persistent reservation
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment