From d4eab1373824ad00681f27765b0bc9200f53480d Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Tue, 11 Sep 2018 11:39:59 +0000 Subject: [PATCH] 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 --- sys/cam/ctl/ctl_frontend_iscsi.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index 83082b0f6469..d5be20c2a215 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -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)