iscsi: Kick threads out of iscsi_ioctl() during unload.
iscsid can be sleeping in iscsi_ioctl() causing the destroy_dev() to sleep forever if iscsi.ko is unloaded while iscsid is running. Reported by: Jithesh Arakkan @ Chelsio Reviewed by: mav MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29688
This commit is contained in:
parent
568e69e4eb
commit
89df484739
@ -1333,6 +1333,11 @@ iscsi_ioctl_daemon_wait(struct iscsi_softc *sc,
|
||||
}
|
||||
|
||||
if (is == NULL) {
|
||||
if (sc->sc_unloading) {
|
||||
sx_sunlock(&sc->sc_lock);
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
/*
|
||||
* No session requires attention from iscsid(8); wait.
|
||||
*/
|
||||
@ -2560,6 +2565,12 @@ static int
|
||||
iscsi_unload(void)
|
||||
{
|
||||
|
||||
/* Awaken any threads asleep in iscsi_ioctl(). */
|
||||
sx_xlock(&sc->sc_lock);
|
||||
sc->sc_unloading = true;
|
||||
cv_signal(&sc->sc_cv);
|
||||
sx_xunlock(&sc->sc_lock);
|
||||
|
||||
if (sc->sc_cdev != NULL) {
|
||||
ISCSI_DEBUG("removing device node");
|
||||
destroy_dev(sc->sc_cdev);
|
||||
|
@ -132,6 +132,7 @@ struct iscsi_softc {
|
||||
TAILQ_HEAD(, iscsi_session) sc_sessions;
|
||||
struct cv sc_cv;
|
||||
unsigned int sc_last_session_id;
|
||||
bool sc_unloading;
|
||||
eventhandler_tag sc_shutdown_pre_eh;
|
||||
eventhandler_tag sc_shutdown_post_eh;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user