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 <emz at norma.perm.ru>
Tested by:	Eugene M. Zheganin <emz at norma.perm.ru>
Approved by:	re (kib)
MFC after:	2 weeks
Sponsored by:	playkey.net
This commit is contained in:
Edward Tomasz Napierala 2018-09-11 11:39:59 +00:00
parent 87acc14608
commit d4eab13738
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=338586

View File

@ -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)