[RFC PATCH 21/48] target: core: checks against peer node SCSI2 reservation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 drivers/target/target_core_pr.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index 2f4c65d5d766..c4329f639323 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -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,
-- 
2.25.1




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux