From owner-svn-src-all@FreeBSD.ORG Wed Oct 9 17:06:05 2013 Return-Path: Delivered-To: svn-src-all@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 ESMTP id 023FA1B1; Wed, 9 Oct 2013 17:06:05 +0000 (UTC) (envelope-from trasz@FreeBSD.org) 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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 69C7725FE; Wed, 9 Oct 2013 17:06:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r99H648k000812; Wed, 9 Oct 2013 17:06:04 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r99H64dw000811; Wed, 9 Oct 2013 17:06:04 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201310091706.r99H64dw000811@svn.freebsd.org> From: Edward Tomasz Napierala Date: Wed, 9 Oct 2013 17:06:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r256197 - 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-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2013 17:06:05 -0000 Author: trasz Date: Wed Oct 9 17:06:03 2013 New Revision: 256197 URL: http://svnweb.freebsd.org/changeset/base/256197 Log: Make the error handling more consistant. Shouldn't make any functional difference. Approved by: re (gjb) Sponsored by: 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 Oct 9 17:05:02 2013 (r256196) +++ head/sys/cam/ctl/ctl_frontend_iscsi.c Wed Oct 9 17:06:03 2013 (r256197) @@ -288,8 +288,8 @@ cfiscsi_pdu_handle(struct icl_pdu *reque CFISCSI_SESSION_WARN(cs, "received PDU with unsupported " "opcode 0x%x; dropping connection", request->ip_bhs->bhs_opcode); - cfiscsi_session_terminate(cs); icl_pdu_free(request); + cfiscsi_session_terminate(cs); } } @@ -532,14 +532,16 @@ cfiscsi_pdu_handle_scsi_command(struct i if (request->ip_data_len > 0 && cs->cs_immediate_data == false) { CFISCSI_SESSION_WARN(cs, "unsolicited data with " "ImmediateData=No; dropping connection"); - cfiscsi_session_terminate(cs); icl_pdu_free(request); + cfiscsi_session_terminate(cs); return; } io = ctl_alloc_io(cs->cs_target->ct_softc->fe.ctl_pool_ref); if (io == NULL) { - CFISCSI_SESSION_WARN(cs, "can't allocate ctl_io"); + CFISCSI_SESSION_WARN(cs, "can't allocate ctl_io; " + "dropping connection"); icl_pdu_free(request); + cfiscsi_session_terminate(cs); return; } ctl_zero_io(io); @@ -579,10 +581,12 @@ cfiscsi_pdu_handle_scsi_command(struct i refcount_acquire(&cs->cs_outstanding_ctl_pdus); error = ctl_queue(io); if (error != CTL_RETVAL_COMPLETE) { - CFISCSI_SESSION_WARN(cs, "ctl_queue() failed; error %d", error); + CFISCSI_SESSION_WARN(cs, "ctl_queue() failed; error %d; " + "dropping connection", error); ctl_free_io(io); refcount_release(&cs->cs_outstanding_ctl_pdus); icl_pdu_free(request); + cfiscsi_session_terminate(cs); } } @@ -600,8 +604,10 @@ cfiscsi_pdu_handle_task_request(struct i bhstmr = (struct iscsi_bhs_task_management_request *)request->ip_bhs; io = ctl_alloc_io(cs->cs_target->ct_softc->fe.ctl_pool_ref); if (io == NULL) { - CFISCSI_SESSION_WARN(cs, "can't allocate ctl_io"); + CFISCSI_SESSION_WARN(cs, "can't allocate ctl_io;" + "dropping connection"); icl_pdu_free(request); + cfiscsi_session_terminate(cs); return; } ctl_zero_io(io); @@ -642,7 +648,10 @@ cfiscsi_pdu_handle_task_request(struct i response = cfiscsi_pdu_new_response(request, M_NOWAIT); if (response == NULL) { + CFISCSI_SESSION_WARN(cs, "failed to allocate memory; " + "dropping connection"); icl_pdu_free(request); + cfiscsi_session_terminate(cs); return; } bhstmr2 = (struct iscsi_bhs_task_management_response *) @@ -661,10 +670,12 @@ cfiscsi_pdu_handle_task_request(struct i refcount_acquire(&cs->cs_outstanding_ctl_pdus); error = ctl_queue(io); if (error != CTL_RETVAL_COMPLETE) { - CFISCSI_SESSION_WARN(cs, "ctl_queue() failed; error %d", error); + CFISCSI_SESSION_WARN(cs, "ctl_queue() failed; error %d; " + "dropping connection", error); ctl_free_io(io); refcount_release(&cs->cs_outstanding_ctl_pdus); icl_pdu_free(request); + cfiscsi_session_terminate(cs); } } @@ -859,8 +870,8 @@ cfiscsi_pdu_handle_data_out(struct icl_p CFISCSI_SESSION_UNLOCK(cs); if (cdw == NULL) { CFISCSI_SESSION_WARN(cs, "data transfer tag 0x%x, initiator task tag " - "0x%x, not found", bhsdo->bhsdo_target_transfer_tag, - bhsdo->bhsdo_initiator_task_tag); + "0x%x, not found; dropping connection", + bhsdo->bhsdo_target_transfer_tag, bhsdo->bhsdo_initiator_task_tag); icl_pdu_free(request); cfiscsi_session_terminate(cs); return; @@ -897,6 +908,7 @@ cfiscsi_pdu_handle_logout_request(struct case BHSLR_REASON_CLOSE_CONNECTION: response = cfiscsi_pdu_new_response(request, M_NOWAIT); if (response == NULL) { + CFISCSI_SESSION_DEBUG(cs, "failed to allocate memory"); icl_pdu_free(request); cfiscsi_session_terminate(cs); return; @@ -914,6 +926,8 @@ cfiscsi_pdu_handle_logout_request(struct case BHSLR_REASON_REMOVE_FOR_RECOVERY: response = cfiscsi_pdu_new_response(request, M_NOWAIT); if (response == NULL) { + CFISCSI_SESSION_WARN(cs, + "failed to allocate memory; dropping connection"); icl_pdu_free(request); cfiscsi_session_terminate(cs); return; @@ -985,7 +999,7 @@ cfiscsi_callout(void *context) cp = icl_pdu_new_bhs(cs->cs_conn, M_NOWAIT); if (cp == NULL) { - CFISCSI_SESSION_WARN(cs, "failed to allocate PDU"); + CFISCSI_SESSION_WARN(cs, "failed to allocate memory"); return; } bhsni = (struct iscsi_bhs_nop_in *)cp->ip_bhs;