Add a new pdu flag : NO_CALLBACK
This flag is used when we dont want the CANCEL callback to be invoked if the
context is destroyed.
Thsi will be used for the sequence where we send multiple PDUs
to the target for one single scsi task, such as
-> WRITE10 cdb
-> DATAOUT
-< RESPONSE
Since if the context is destroyed when the command is in flight, we
already get the CANCEL callback for the WRITE10 PDU, so we dont need to invoke
it again for when we destroy the DATAOUT pdu, since they both refer to the same
task.
This commit is contained in:
@@ -152,6 +152,8 @@ struct iscsi_pdu {
|
||||
|
||||
/* There will not be a response to this pdu, so delete it once it is sent on the wire. Dont put it on the wait-queue */
|
||||
#define ISCSI_PDU_DELETE_WHEN_SENT 0x00000001
|
||||
/* Dont call the CANCEL callback when the context is destroyed */
|
||||
#define ISCSI_PDU_NO_CALLBACK 0x00000002
|
||||
uint32_t flags;
|
||||
|
||||
uint32_t itt;
|
||||
|
||||
@@ -138,14 +138,16 @@ iscsi_destroy_context(struct iscsi_context *iscsi)
|
||||
|
||||
while ((pdu = iscsi->outqueue)) {
|
||||
SLIST_REMOVE(&iscsi->outqueue, pdu);
|
||||
pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL,
|
||||
pdu->private_data);
|
||||
if ( !(pdu->flags & ISCSI_PDU_NO_CALLBACK)) {
|
||||
pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL,
|
||||
pdu->private_data);
|
||||
}
|
||||
iscsi_free_pdu(iscsi, pdu);
|
||||
}
|
||||
while ((pdu = iscsi->waitpdu)) {
|
||||
SLIST_REMOVE(&iscsi->waitpdu, pdu);
|
||||
pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL,
|
||||
pdu->private_data);
|
||||
pdu->private_data);
|
||||
iscsi_free_pdu(iscsi, pdu);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user