aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_pr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/target/target_core_pr.c')
-rw-r--r--drivers/target/target_core_pr.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index 956c84c6b666..8c323a98c4a0 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -197,10 +197,10 @@ int target_scsi2_reservation_release(struct se_cmd *cmd)
197{ 197{
198 struct se_device *dev = cmd->se_dev; 198 struct se_device *dev = cmd->se_dev;
199 struct se_session *sess = cmd->se_sess; 199 struct se_session *sess = cmd->se_sess;
200 struct se_portal_group *tpg = sess->se_tpg; 200 struct se_portal_group *tpg;
201 int ret = 0, rc; 201 int ret = 0, rc;
202 202
203 if (!sess || !tpg) 203 if (!sess || !sess->se_tpg)
204 goto out; 204 goto out;
205 rc = target_check_scsi2_reservation_conflict(cmd); 205 rc = target_check_scsi2_reservation_conflict(cmd);
206 if (rc == 1) 206 if (rc == 1)
@@ -228,6 +228,7 @@ int target_scsi2_reservation_release(struct se_cmd *cmd)
228 dev->dev_res_bin_isid = 0; 228 dev->dev_res_bin_isid = 0;
229 dev->dev_flags &= ~DF_SPC2_RESERVATIONS_WITH_ISID; 229 dev->dev_flags &= ~DF_SPC2_RESERVATIONS_WITH_ISID;
230 } 230 }
231 tpg = sess->se_tpg;
231 pr_debug("SCSI-2 Released reservation for %s LUN: %u ->" 232 pr_debug("SCSI-2 Released reservation for %s LUN: %u ->"
232 " MAPPED LUN: %u for %s\n", tpg->se_tpg_tfo->get_fabric_name(), 233 " MAPPED LUN: %u for %s\n", tpg->se_tpg_tfo->get_fabric_name(),
233 cmd->se_lun->unpacked_lun, cmd->se_deve->mapped_lun, 234 cmd->se_lun->unpacked_lun, cmd->se_deve->mapped_lun,
@@ -245,7 +246,7 @@ int target_scsi2_reservation_reserve(struct se_cmd *cmd)
245{ 246{
246 struct se_device *dev = cmd->se_dev; 247 struct se_device *dev = cmd->se_dev;
247 struct se_session *sess = cmd->se_sess; 248 struct se_session *sess = cmd->se_sess;
248 struct se_portal_group *tpg = sess->se_tpg; 249 struct se_portal_group *tpg;
249 int ret = 0, rc; 250 int ret = 0, rc;
250 251
251 if ((cmd->t_task_cdb[1] & 0x01) && 252 if ((cmd->t_task_cdb[1] & 0x01) &&
@@ -260,7 +261,7 @@ int target_scsi2_reservation_reserve(struct se_cmd *cmd)
260 * This is currently the case for target_core_mod passthrough struct se_cmd 261 * This is currently the case for target_core_mod passthrough struct se_cmd
261 * ops 262 * ops
262 */ 263 */
263 if (!sess || !tpg) 264 if (!sess || !sess->se_tpg)
264 goto out; 265 goto out;
265 rc = target_check_scsi2_reservation_conflict(cmd); 266 rc = target_check_scsi2_reservation_conflict(cmd);
266 if (rc == 1) 267 if (rc == 1)
@@ -272,6 +273,7 @@ int target_scsi2_reservation_reserve(struct se_cmd *cmd)
272 } 273 }
273 274
274 ret = 0; 275 ret = 0;
276 tpg = sess->se_tpg;
275 spin_lock(&dev->dev_reservation_lock); 277 spin_lock(&dev->dev_reservation_lock);
276 if (dev->dev_reserved_node_acl && 278 if (dev->dev_reserved_node_acl &&
277 (dev->dev_reserved_node_acl != sess->se_node_acl)) { 279 (dev->dev_reserved_node_acl != sess->se_node_acl)) {
@@ -1620,7 +1622,7 @@ static int core_scsi3_decode_spec_i_port(
1620 goto out; 1622 goto out;
1621 } 1623 }
1622 /* 1624 /*
1623 * Locate the desination initiator ACL to be registered 1625 * Locate the destination initiator ACL to be registered
1624 * from the decoded fabric module specific TransportID 1626 * from the decoded fabric module specific TransportID
1625 * at *i_str. 1627 * at *i_str.
1626 */ 1628 */
@@ -4257,7 +4259,7 @@ static int core_scsi3_pri_read_full_status(struct se_cmd *cmd)
4257 buf[off++] = ((port->sep_rtpi >> 8) & 0xff); 4259 buf[off++] = ((port->sep_rtpi >> 8) & 0xff);
4258 buf[off++] = (port->sep_rtpi & 0xff); 4260 buf[off++] = (port->sep_rtpi & 0xff);
4259 } else 4261 } else
4260 off += 2; /* Skip over RELATIVE TARGET PORT IDENTIFER */ 4262 off += 2; /* Skip over RELATIVE TARGET PORT IDENTIFIER */
4261 4263
4262 /* 4264 /*
4263 * Now, have the $FABRIC_MOD fill in the protocol identifier 4265 * Now, have the $FABRIC_MOD fill in the protocol identifier