From owner-svn-src-head@FreeBSD.ORG Wed Apr 16 10:37:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0E5BF4F2; Wed, 16 Apr 2014 10:37:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D57081A7B; Wed, 16 Apr 2014 10:37:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3GAbQlO065371; Wed, 16 Apr 2014 10:37:26 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3GAbQB4065370; Wed, 16 Apr 2014 10:37:26 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201404161037.s3GAbQB4065370@svn.freebsd.org> From: Edward Tomasz Napierala Date: Wed, 16 Apr 2014 10:37:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r264527 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Apr 2014 10:37:27 -0000 Author: trasz Date: Wed Apr 16 10:37:26 2014 New Revision: 264527 URL: http://svnweb.freebsd.org/changeset/base/264527 Log: Make it possible to interrupt login when running in proxy mode. Sponsored by: The FreeBSD Foundation Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_iscsi.c Wed Apr 16 10:29:34 2014 (r264526) +++ head/sys/cam/ctl/ctl_frontend_iscsi.c Wed Apr 16 10:37:26 2014 (r264527) @@ -1130,6 +1130,9 @@ cfiscsi_session_terminate(struct cfiscsi return; cs->cs_terminating = 1; cv_signal(&cs->cs_maintenance_cv); +#ifdef ICL_KERNEL_PROXY + cv_signal(&cs->cs_login_cv); +#endif } static int @@ -1864,6 +1867,7 @@ cfiscsi_ioctl_receive(struct ctl_iscsi * struct cfiscsi_session *cs; struct icl_pdu *ip; void *data; + int error; cirp = (struct ctl_iscsi_receive_params *)&(ci->data); @@ -1874,7 +1878,8 @@ cfiscsi_ioctl_receive(struct ctl_iscsi * } if (cs == NULL) { mtx_unlock(&cfiscsi_softc.lock); - snprintf(ci->error_str, sizeof(ci->error_str), "connection not found"); + snprintf(ci->error_str, sizeof(ci->error_str), + "connection not found"); ci->status = CTL_ISCSI_ERROR; return; } @@ -1886,12 +1891,21 @@ cfiscsi_ioctl_receive(struct ctl_iscsi * #endif CFISCSI_SESSION_LOCK(cs); - while (cs->cs_login_pdu == NULL && - cs->cs_terminating == false) - cv_wait(&cs->cs_login_cv, &cs->cs_lock); + while (cs->cs_login_pdu == NULL && cs->cs_terminating == false) { + error = cv_wait_sig(&cs->cs_login_cv, &cs->cs_lock); + if (error != 0) { + CFISCSI_SESSION_UNLOCK(cs); + snprintf(ci->error_str, sizeof(ci->error_str), + "interrupted by signal"); + ci->status = CTL_ISCSI_ERROR; + return; + } + } + if (cs->cs_terminating) { CFISCSI_SESSION_UNLOCK(cs); - snprintf(ci->error_str, sizeof(ci->error_str), "connection terminating"); + snprintf(ci->error_str, sizeof(ci->error_str), + "connection terminating"); ci->status = CTL_ISCSI_ERROR; return; } @@ -1901,7 +1915,8 @@ cfiscsi_ioctl_receive(struct ctl_iscsi * if (ip->ip_data_len > cirp->data_segment_len) { icl_pdu_free(ip); - snprintf(ci->error_str, sizeof(ci->error_str), "data segment too big"); + snprintf(ci->error_str, sizeof(ci->error_str), + "data segment too big"); ci->status = CTL_ISCSI_ERROR; return; }