SPC-2 RESERVE tests: Use MODE SENSE instead of TEST UNIT READY

Although SPC-2 specifies that a reservation conflict should be
reported when TEST UNIT READY is received from another initiator than
the registered initiator, it is an established practice that TEST
UNIT READY is accepted in this case. Hence use the MODE SENSE command
to test the effect of the RESERVE command instead of TEST UNIT READY.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
This commit is contained in:
Bart Van Assche
2014-07-15 08:45:39 +02:00
committed by Ronnie Sahlberg
parent bb8d01e093
commit b631a2146c
3 changed files with 24 additions and 5 deletions
+18
View File
@@ -1720,6 +1720,24 @@ testunitready_conflict(struct iscsi_context *iscsi, int lun)
return 0;
}
/*
* Returns -1 if allocating a SCSI task failed or if a communication error
* occurred and a SCSI status if a SCSI response has been received.
*/
int mode_sense(struct iscsi_context *iscsi, int lun)
{
struct scsi_task *t;
enum scsi_status ret = -1;
t = iscsi_modesense6_sync(iscsi, lun, 0, SCSI_MODESENSE_PC_CURRENT,
SCSI_MODEPAGE_RETURN_ALL_PAGES, 0, 255);
if (t) {
ret = t->status;
scsi_free_scsi_task(t);
}
return ret;
}
int compareandwrite(struct iscsi_context *iscsi, int lun, uint64_t lba,
unsigned char *data, uint32_t len, int blocksize,
int wrprotect, int dpo,