aboutsummaryrefslogtreecommitdiff
path: root/drivers/target/target_core_transport.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2012-10-10 17:37:15 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2012-11-06 20:55:45 -0800
commitd977f4377fbc396b888e12fdb3b13118b09ca7db (patch)
treef3de282b1df951ec599908e24590dbcbac5b9047 /drivers/target/target_core_transport.c
parent019c4ca621488739b1bfb7597a14ac7f0cbcc908 (diff)
target: simplify reservations code
We do not support host-level reservations for the pscsi backend, and all virtual backends are newere than SCSI-2, so just make the combined SPC-3 + SCSI-2 support the only supported variant and kill the switches for the different implementations, given that this code handles the no-op version just fine. (hch: Update DRF_SPC2_RESERVATIONS lock usage) Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/target/target_core_transport.c')
-rw-r--r--drivers/target/target_core_transport.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 757e3777ce7..e996bdf480c 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1103,7 +1103,6 @@ int target_setup_cmd_from_cdb(
unsigned char *cdb)
{
struct se_device *dev = cmd->se_dev;
- u32 pr_reg_type = 0;
u8 alua_ascq = 0;
unsigned long flags;
int ret;
@@ -1180,20 +1179,13 @@ int target_setup_cmd_from_cdb(
/*
* Check status for SPC-3 Persistent Reservations
*/
- if (dev->t10_pr.pr_ops.t10_reservation_check(cmd, &pr_reg_type)) {
- if (dev->t10_pr.pr_ops.t10_seq_non_holder(
- cmd, cdb, pr_reg_type) != 0) {
- cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION;
- cmd->se_cmd_flags |= SCF_SCSI_RESERVATION_CONFLICT;
- cmd->scsi_status = SAM_STAT_RESERVATION_CONFLICT;
- cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT;
- return -EBUSY;
- }
- /*
- * This means the CDB is allowed for the SCSI Initiator port
- * when said port is *NOT* holding the legacy SPC-2 or
- * SPC-3 Persistent Reservation.
- */
+ ret = target_check_reservation(cmd);
+ if (ret) {
+ cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION;
+ cmd->se_cmd_flags |= SCF_SCSI_RESERVATION_CONFLICT;
+ cmd->scsi_status = SAM_STAT_RESERVATION_CONFLICT;
+ cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT;
+ return ret;
}
ret = dev->transport->parse_cdb(cmd);