From owner-svn-src-all@freebsd.org Sat Sep 1 16:16:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F034EFF3BC1; Sat, 1 Sep 2018 16:16:40 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AE23F7233B; Sat, 1 Sep 2018 16:16:40 +0000 (UTC) (envelope-from trasz@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A4F9D4C1C; Sat, 1 Sep 2018 16:16:40 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w81GGeX7036531; Sat, 1 Sep 2018 16:16:40 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w81GGe7g036530; Sat, 1 Sep 2018 16:16:40 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201809011616.w81GGe7g036530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 1 Sep 2018 16:16:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338426 - head/sys/cam/ctl X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/cam/ctl X-SVN-Commit-Revision: 338426 X-SVN-Commit-Repository: base 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.27 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: Sat, 01 Sep 2018 16:16:41 -0000 Author: trasz Date: Sat Sep 1 16:16:40 2018 New Revision: 338426 URL: https://svnweb.freebsd.org/changeset/base/338426 Log: Try harder in cfiscsi_offline(). This is believed to be the workaround for the "ctld hanging on reload" problem observed in same cases under high load. I'm not 100% sure it's _the_ fix, as the issue is rather hard to reproduce, but it was tested as part of a larger path and the problem disappeared. It certainly shouldn't break anything. Now, technically, it shouldn't be needed. Quoting mav@, "After ct->ct_online == 0 there should be no new sessions attached to the target. And if you see some problems abbout it, it may either mean that there are some races where single cfiscsi_session_terminate(cs) call may be lost, or as a guess while this thread was sleeping target was reenabbled and redisabled again". Should such race be discovered and properly fixed in the future, than this and the followup two commits can be backed out. PR: 220175 Reported by: Eugene M. Zheganin Tested by: Eugene M. Zheganin Discussed with: mav Approved by: re (gjb) MFC after: 2 weeks Sponsored by: playkey.net 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 Sat Sep 1 16:13:56 2018 (r338425) +++ head/sys/cam/ctl/ctl_frontend_iscsi.c Sat Sep 1 16:16:40 2018 (r338426) @@ -1447,11 +1447,11 @@ cfiscsi_offline(void *arg) ct->ct_online = 0; online = --softc->online; - TAILQ_FOREACH(cs, &softc->sessions, cs_next) { - if (cs->cs_target == ct) - cfiscsi_session_terminate(cs); - } do { + TAILQ_FOREACH(cs, &softc->sessions, cs_next) { + if (cs->cs_target == ct) + cfiscsi_session_terminate(cs); + } TAILQ_FOREACH(cs, &softc->sessions, cs_next) { if (cs->cs_target == ct) break;