@@ -95,7 +95,8 @@ target_scsi2_reservation_check(struct se_cmd *cmd)
break;
}
- if (dev->reservation_holder->se_node_acl != sess->se_node_acl)
+ if (!dev->reservation_holder ||
+ dev->reservation_holder->se_node_acl != sess->se_node_acl)
return TCM_RESERVATION_CONFLICT;
if (dev->dev_reservation_flags & DRF_SPC2_RESERVATIONS_WITH_ISID) {
@@ -211,6 +212,9 @@ target_scsi2_reservation_release(struct se_cmd *cmd)
if (!(dev->dev_reservation_flags & DRF_SPC2_RESERVATIONS))
goto out_unlock;
+ if (!dev->reservation_holder)
+ goto out_unlock;
+
if (dev->reservation_holder->se_node_acl != sess->se_node_acl)
goto out_unlock;
@@ -262,12 +266,15 @@ target_scsi2_reservation_reserve(struct se_cmd *cmd)
tpg = sess->se_tpg;
spin_lock(&dev->dev_reservation_lock);
if ((dev->dev_reservation_flags & DRF_SPC2_RESERVATIONS) &&
- dev->reservation_holder->se_node_acl != sess->se_node_acl) {
+ (!dev->reservation_holder ||
+ dev->reservation_holder->se_node_acl != sess->se_node_acl)) {
pr_err("SCSI-2 RESERVATION CONFLICT for %s fabric\n",
tpg->se_tpg_tfo->fabric_name);
pr_err("Original reserver LUN: %llu %s\n",
cmd->se_lun->unpacked_lun,
- dev->reservation_holder->se_node_acl->initiatorname);
+ (dev->reservation_holder) ?
+ dev->reservation_holder->se_node_acl->initiatorname :
+ "peer");
pr_err("Current attempt - LUN: %llu -> MAPPED LUN: %llu"
" from %s \n", cmd->se_lun->unpacked_lun,
cmd->orig_fe_lun,
For the case of SCSI-2 reservation by peer node dev->reservation_holder session is NULL. So use this information as reservation existence. Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com> --- drivers/target/target_core_pr.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)