From nobody@FreeBSD.org  Sat Dec 28 06:05:45 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTPS id 462BDDFE
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 28 Dec 2013 06:05:45 +0000 (UTC)
Received: from oldred.freebsd.org (oldred.freebsd.org [IPv6:2001:1900:2254:206a::50:4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id 3141A1152
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 28 Dec 2013 06:05:45 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id rBS65ibU052721
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 28 Dec 2013 06:05:44 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id rBS65iAU052707;
	Sat, 28 Dec 2013 06:05:44 GMT
	(envelope-from nobody)
Message-Id: <201312280605.rBS65iAU052707@oldred.freebsd.org>
Date: Sat, 28 Dec 2013 06:05:44 GMT
From: Darcy Birkbeck <dbirkbeck@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: ISCSI is vey slow to connect and mount a volume when data digest is enabled in FreeBSD 10 RC3 (amd64)
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         185240
>Category:       kern
>Synopsis:       [iscsi] ISCSI is vey slow to connect and mount a volume when data digest is enabled in FreeBSD 10 RC3 (amd64)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    trasz
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Dec 28 06:10:00 UTC 2013
>Closed-Date:    Tue Feb 11 11:59:37 UTC 2014
>Last-Modified:  Tue Feb 11 11:59:37 UTC 2014
>Originator:     Darcy Birkbeck
>Release:        FreeBSD 10 RC3 amd64
>Organization:
>Environment:
FreeBSD  10.0-RC3 FreeBSD 10.0-RC3 #0 r259778: Mon Dec 23 23:27:58 UTC 2013     root@snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
Connections (and mounts) to a FreeBSD RC3 (amd64) host running the ctld daemon take a very long time (ie: minutes) to establish if data digest is enabled.  If no digest or only header digest is enabled connections and mounts occur quickly.

The initiators I have tested include the built in Windows 7 initiator and GlobalSAN on OSX Mavericks.  (Latest 5.2 beta)

The following is the ctl.conf file used:

pidfile /var/run/ctld.pid

auth-group users1 {
        chap "user" "secret"
}

portal-group portal1 {
        discovery-auth-group no-authentication
        listen 0.0.0.0
        listen [::]
}

target iqn.2012-06.com.example:target0 {
        auth-group users1
        portal-group portal1
        lun 0 {
                path /dev/zvol/test/a
                size 2G
        }
}
>How-To-Repeat:
Enable data digest in either the WIndows iscsi initiator or the GlobalSAN 5.2 beta initiator will cause the target to take a long time to connect and mount.

With no digests enabled or only the header digest enabled the connection and mount occurs as expected.
>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-amd64->trasz 
Responsible-Changed-By: trasz 
Responsible-Changed-When: Sun Dec 29 22:38:52 UTC 2013 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=185240 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/185240: commit references a PR
Date: Mon, 30 Dec 2013 12:18:14 +0000 (UTC)

 Author: trasz
 Date: Mon Dec 30 12:18:06 2013
 New Revision: 260083
 URL: http://svnweb.freebsd.org/changeset/base/260083
 
 Log:
   Fix extremely slow operation with data digests enabled.  This was caused
   by receive code waiting for data digest even when the data segment was
   empty.  It didn't actually read it, but it waited until those four bytes
   become available in the socket buffer, i.e. until any other PDU (such as NOP)
   came in.
   
   PR:		kern/185240
   MFC after:	2 weeks
   Sponsored by:	The FreeBSD Foundation
 
 Modified:
   head/sys/dev/iscsi/icl.c
 
 Modified: head/sys/dev/iscsi/icl.c
 ==============================================================================
 --- head/sys/dev/iscsi/icl.c	Mon Dec 30 09:04:06 2013	(r260082)
 +++ head/sys/dev/iscsi/icl.c	Mon Dec 30 12:18:06 2013	(r260083)
 @@ -239,7 +239,7 @@ icl_pdu_size(const struct icl_pdu *respo
  	    icl_pdu_padding(response);
  	if (response->ip_conn->ic_header_crc32c)
  		len += ISCSI_HEADER_DIGEST_SIZE;
 -	if (response->ip_conn->ic_data_crc32c)
 +	if (response->ip_data_len != 0 && response->ip_conn->ic_data_crc32c)
  		len += ISCSI_DATA_DIGEST_SIZE;
  
  	return (len);
 @@ -615,7 +615,7 @@ icl_conn_receive_pdu(struct icl_conn *ic
  			break;
  
  		ic->ic_receive_state = ICL_CONN_STATE_DATA_DIGEST;
 -		if (ic->ic_data_crc32c == false)
 +		if (request->ip_data_len == 0 || ic->ic_data_crc32c == false)
  			ic->ic_receive_len = 0;
  		else
  			ic->ic_receive_len = ISCSI_DATA_DIGEST_SIZE;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: trasz 
State-Changed-When: Tue Feb 11 11:59:37 UTC 2014 
State-Changed-Why:  
Fixed in 10-STABLE.  Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=185240 
>Unformatted:
