From owner-svn-src-head@freebsd.org Tue Sep 11 11:40:00 2018 Return-Path: Delivered-To: svn-src-head@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 883A8108DF0F; Tue, 11 Sep 2018 11:40:00 +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 3BB8F731C1; Tue, 11 Sep 2018 11:40:00 +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 36B231735C; Tue, 11 Sep 2018 11:40:00 +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 w8BBdxuJ074006; Tue, 11 Sep 2018 11:39:59 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8BBdxAf074005; Tue, 11 Sep 2018 11:39:59 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201809111139.w8BBdxAf074005@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 11 Sep 2018 11:39:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338586 - 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: 338586 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.27 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, 11 Sep 2018 11:40:00 -0000 Author: trasz Date: Tue Sep 11 11:39:59 2018 New Revision: 338586 URL: https://svnweb.freebsd.org/changeset/base/338586 Log: Make the wait in cfiscsi_offline() interruptible. This is the second half of the fix/workaround for the "ctld hanging on reload" problem. PR: 220175 Reported by: Eugene M. Zheganin Tested by: Eugene M. Zheganin Approved by: re (kib) 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 Tue Sep 11 10:10:25 2018 (r338585) +++ head/sys/cam/ctl/ctl_frontend_iscsi.c Tue Sep 11 11:39:59 2018 (r338586) @@ -1434,7 +1434,7 @@ cfiscsi_offline(void *arg) struct cfiscsi_softc *softc; struct cfiscsi_target *ct; struct cfiscsi_session *cs; - int online; + int error, online; ct = (struct cfiscsi_target *)arg; softc = ct->ct_softc; @@ -1456,8 +1456,14 @@ cfiscsi_offline(void *arg) if (cs->cs_target == ct) break; } - if (cs != NULL) - cv_wait(&softc->sessions_cv, &softc->lock); + if (cs != NULL) { + error = cv_wait_sig(&softc->sessions_cv, &softc->lock); + if (error != 0) { + CFISCSI_SESSION_DEBUG(cs, + "cv_wait failed with error %d\n", error); + break; + } + } } while (cs != NULL && ct->ct_online == 0); mtx_unlock(&softc->lock); if (online > 0)