path: root/sys/cam/ctl
diff options
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2018-09-01 16:16:40 +0000
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2018-09-01 16:16:40 +0000
commitd783154e46adab8d7d7a50c8d552df90e644b908 (patch)
tree151ef1e8f3779d5a01ed809f40276b6517f40f67 /sys/cam/ctl
parentbf466ddcffcfadaf9d1ec551cdf1c745a90013b5 (diff)
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 <emz at norma.perm.ru> Tested by: Eugene M. Zheganin <emz at norma.perm.ru> Discussed with: mav Approved by: re (gjb) MFC after: 2 weeks Sponsored by: playkey.net
Notes: svn path=/head/; revision=338426
Diffstat (limited to 'sys/cam/ctl')
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c
index 2d3766a8e73b..83082b0f6469 100644
--- a/sys/cam/ctl/ctl_frontend_iscsi.c
+++ b/sys/cam/ctl/ctl_frontend_iscsi.c
@@ -1447,13 +1447,13 @@ 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)
if (cs != NULL)