git: 94b27fc812d1 - stable/13 - iscsi: Use ICL_NOCOPY for SCSI command immediate data and R2T.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Wed, 11 May 2022 21:04:34 UTC
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=94b27fc812d1e6c635a50a757f6c35533ae37a74

commit 94b27fc812d1e6c635a50a757f6c35533ae37a74
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-03-10 23:48:20 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-05-11 20:50:26 +0000

    iscsi: Use ICL_NOCOPY for SCSI command immediate data and R2T.
    
    The associated csio ccb will not be completed via xpt_done() until
    after the associated PDUs are transmitted to the other side and either
    the original PDU is acked with a SCSI response, or a response is
    received for a subsequent abort CCB (which means the earlier PDU has
    also been sent since it would have been sent before the abort PDU).
    
    This does assume that once an I/O request has been aborted, no further
    PDUs with data payload are queued for that I/O request.
    
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D34405
    
    (cherry picked from commit 9c7a4875bce9d0f8308f92a816abf36af8551914)
---
 sys/dev/iscsi/iscsi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c
index 278f275d7309..155faa0910e4 100644
--- a/sys/dev/iscsi/iscsi.c
+++ b/sys/dev/iscsi/iscsi.c
@@ -1283,7 +1283,7 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response)
 		bhsdo->bhsdo_datasn = htonl(datasn);
 		bhsdo->bhsdo_buffer_offset = htonl(off);
 		error = icl_pdu_append_data(request, csio->data_ptr + off, len,
-		    M_NOWAIT);
+		    M_NOWAIT | ICL_NOCOPY);
 		if (error != 0) {
 			ISCSI_SESSION_WARN(is, "failed to allocate memory; "
 			    "reconnecting");
@@ -2387,7 +2387,8 @@ iscsi_action_scsiio(struct iscsi_session *is, union ccb *ccb)
 			len = is->is_conn->ic_max_send_data_segment_length;
 		}
 
-		error = icl_pdu_append_data(request, csio->data_ptr, len, M_NOWAIT);
+		error = icl_pdu_append_data(request, csio->data_ptr, len,
+		    M_NOWAIT | ICL_NOCOPY);
 		if (error != 0) {
 			iscsi_outstanding_remove(is, io);
 			icl_pdu_free(request);