From owner-svn-src-head@freebsd.org Tue Oct 17 16:04:01 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34C3FE3EE4E; Tue, 17 Oct 2017 16:04:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 0EEE772D31; Tue, 17 Oct 2017 16:04:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9HG402E014843; Tue, 17 Oct 2017 16:04:00 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9HG40a5014842; Tue, 17 Oct 2017 16:04:00 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201710171604.v9HG40a5014842@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 17 Oct 2017 16:04:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324694 - head/sys/dev/iscsi X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/iscsi X-SVN-Commit-Revision: 324694 X-SVN-Commit-Repository: base 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.23 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: Tue, 17 Oct 2017 16:04:01 -0000 Author: avg Date: Tue Oct 17 16:03:59 2017 New Revision: 324694 URL: https://svnweb.freebsd.org/changeset/base/324694 Log: never retry oustanding requests when terminating iscsi session CAM_REQ_ABORTED sounds natural for aborting outstanding requests when tearing down a session, but that status actually causes eligible requests to be tried again. That's completely useless, so let's use CAM_DEV_NOT_THERE instead. Perhaps there is a better status, but this should be good enough. The change should affect only the session termination. Tested by: Ben RUBSON Reviewed by: mav, trasz MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D12653 Modified: head/sys/dev/iscsi/iscsi.c Modified: head/sys/dev/iscsi/iscsi.c ============================================================================== --- head/sys/dev/iscsi/iscsi.c Tue Oct 17 15:53:22 2017 (r324693) +++ head/sys/dev/iscsi/iscsi.c Tue Oct 17 16:03:59 2017 (r324694) @@ -291,17 +291,14 @@ iscsi_session_logout(struct iscsi_session *is) static void iscsi_session_terminate_task(struct iscsi_session *is, - struct iscsi_outstanding *io, bool requeue) + struct iscsi_outstanding *io, cam_status status) { ISCSI_SESSION_LOCK_ASSERT(is); if (io->io_ccb != NULL) { io->io_ccb->ccb_h.status &= ~(CAM_SIM_QUEUED | CAM_STATUS_MASK); - if (requeue) - io->io_ccb->ccb_h.status |= CAM_REQUEUE_REQ; - else - io->io_ccb->ccb_h.status |= CAM_REQ_ABORTED; + io->io_ccb->ccb_h.status |= status; if ((io->io_ccb->ccb_h.status & CAM_DEV_QFRZN) == 0) { io->io_ccb->ccb_h.status |= CAM_DEV_QFRZN; xpt_freeze_devq(io->io_ccb->ccb_h.path, 1); @@ -313,14 +310,14 @@ iscsi_session_terminate_task(struct iscsi_session *is, } static void -iscsi_session_terminate_tasks(struct iscsi_session *is, bool requeue) +iscsi_session_terminate_tasks(struct iscsi_session *is, cam_status status) { struct iscsi_outstanding *io, *tmp; ISCSI_SESSION_LOCK_ASSERT(is); TAILQ_FOREACH_SAFE(io, &is->is_outstanding, io_next, tmp) { - iscsi_session_terminate_task(is, io, requeue); + iscsi_session_terminate_task(is, io, status); } } @@ -354,11 +351,11 @@ iscsi_session_cleanup(struct iscsi_session *is, bool d /* * Terminate SCSI tasks, asking CAM to requeue them. */ - iscsi_session_terminate_tasks(is, true); + iscsi_session_terminate_tasks(is, CAM_REQUEUE_REQ); return; } - iscsi_session_terminate_tasks(is, false); + iscsi_session_terminate_tasks(is, CAM_DEV_NOT_THERE); if (is->is_sim == NULL) return; @@ -1021,7 +1018,7 @@ iscsi_pdu_handle_task_response(struct icl_pdu *respons } else { aio = iscsi_outstanding_find(is, io->io_datasn); if (aio != NULL && aio->io_ccb != NULL) - iscsi_session_terminate_task(is, aio, false); + iscsi_session_terminate_task(is, aio, CAM_REQ_ABORTED); } iscsi_outstanding_remove(is, io);