[ofa-general] [PATCH] iser: avoid recv buf exhaustion v2 (resend)

Or Gerlitz ogerlitz at voltaire.com
Mon Dec 8 07:39:17 PST 2008


David Disseldorp wrote:
> --- a/drivers/infiniband/ulp/iser/iser_initiator.c
> +++ b/drivers/infiniband/ulp/iser/iser_initiator.c
> @@ -478,6 +508,7 @@ int iser_send_control(struct iscsi_conn *conn,
>  	int err = 0;
>  	struct iser_regd_buf *regd_buf;
>  	struct iser_device *device;
> +	unsigned char opcode;
>  
>  	if (!iser_conn_state_comp(iser_conn->ib_conn, ISER_CONN_UP)) {
>  		iser_err("Failed to send, conn: 0x%p is not up\n", iser_conn->ib_conn);
> @@ -512,10 +543,16 @@ int iser_send_control(struct iscsi_conn *conn,
>  				       data_seg_len);
>  	}
>  
> -	if (iser_post_receive_control(conn) != 0) {
> -		iser_err("post_rcv_buff failed!\n");
> -		err = -ENOMEM;
> -		goto send_control_error;
> +	opcode = task->hdr->opcode & ISCSI_OPCODE_MASK;
> +
> +	/* post recv buffer for response if one is expected */
> +	if (!((opcode == ISCSI_OP_NOOP_OUT)
> +	 && (task->hdr->itt == RESERVED_ITT))) {
> +		if (iser_post_receive_control(conn) != 0) {
> +			iser_err("post_rcv_buff failed!\n");
> +			err = -ENOMEM;
> +			goto send_control_error;
> +		}
>  	}

This logic will not let us refill the receive buffers consumes by 
unexpected PDUs when a Nop-Out with reserved ITT is sent. So the next 
refill will take place when the next scsi command is issued or when a 
Nop-Out will be sent with non-reserved ITT. I am fine with this.

Acked-by: Or Gerlitz <ogerlitz at voltaire.com>





More information about the general mailing list