In selfdfree re-evaulate sf_si after takin the lock.

Otherwise we can race with doselwakeup.

This is a fixup to r273549

Reviewed by:	jhb
Reported by:	everyone and their dog
This commit is contained in:
Mateusz Guzik 2014-10-23 19:06:08 +00:00
parent 2735a91d93
commit ffc5ce7b75

View File

@ -1602,7 +1602,8 @@ selfdfree(struct seltd *stp, struct selfd *sfp)
STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link);
if (sfp->sf_si != NULL) {
mtx_lock(sfp->sf_mtx);
TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads);
if (sfp->sf_si != NULL)
TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads);
mtx_unlock(sfp->sf_mtx);
}
uma_zfree(selfd_zone, sfp);