istgt does not appear to shut down cleanly
John
jwd at freebsd.org
Mon Mar 12 14:47:02 UTC 2012
----- John's Original Message -----
> Hi Folks,
>
> I've been putting together a zfs server which exports zvols
> via istgt:
>
> #istgt -V
> istgt version 0.4
> istgt extra version 20111008
>
> and about a 1 month old 9-stable:
>
> 9.0-STABLE FreeBSD 9.0-STABLE #0 r231864M: Fri Feb 17 23:21:34 UTC 2012
>
> When adding a new LUC/LUN combination, I want to terminate and then
> restart the daemon. However, istgt does not appear to completely exit.
Hi Folks,
Following up on my own posting. It appears that istgt is configured to
use kqueue to handle signals. However, it still pthread_create()s the
signal handler thread which requires the 2nd signal to get the thread to
exit cleanly.
Ifdef'ing out the pthread_create() and related code seems to fix the
problem. Added NOSIGTHREAD.
This seems to fix things nicely.
Thanks,
John
#diff -u istgt.c.orig istgt.c [/usr/ports/net/istgt/work/istgt-20111008/src]
--- istgt.c.orig 2012-03-12 12:14:12.000000000 +0000
+++ istgt.c 2012-03-12 14:28:34.000000000 +0000
@@ -1749,6 +1758,7 @@
#endif
sigaddset(&signew, ISTGT_SIGWAKEUP);
pthread_sigmask(SIG_SETMASK, &signew, &sigold);
+#ifdef NOSIGTHREAD
#ifdef ISTGT_STACKSIZE
rc = pthread_create(&sigthread, &istgt->attr, &istgt_sighandler,
#else
@@ -1766,8 +1776,11 @@
goto initialize_error;
}
#endif
+#endif
#ifdef HAVE_PTHREAD_SET_NAME_NP
+#ifdef NOSIGTHREAD
pthread_set_name_np(sigthread, "sigthread");
+#endif
pthread_set_name_np(pthread_self(), "mainthread");
#endif
@@ -1847,12 +1860,14 @@
istgt_free_config(config);
istgt_set_state(istgt, ISTGT_STATE_SHUTDOWN);
+#ifdef NOSIGTHREAD
/* stop signal thread */
rc = pthread_join(sigthread, NULL);
if (rc != 0) {
ISTGT_ERRLOG("pthread_join() failed\n");
exit (EXIT_FAILURE);
}
+#endif
return 0;
}
More information about the freebsd-scsi
mailing list