diff --git a/include/iscsi-private.h b/include/iscsi-private.h index a1a33b9..859391a 100644 --- a/include/iscsi-private.h +++ b/include/iscsi-private.h @@ -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; diff --git a/lib/init.c b/lib/init.c index 4e8d681..e5eef93 100644 --- a/lib/init.c +++ b/lib/init.c @@ -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); }