HomeFreeBSD

sound: Remove CHN_F_SLEEPING

Description

sound: Remove CHN_F_SLEEPING

The KASSERT in chn_sleep() can be triggered if more than one thread
wants to sleep on a given channel at the same time. While this is not
really a common scenario, tools such as stress2, which use fork() and
the child process(es) inherit the parent's FDs as a result, we can end
up triggering such scenarios.

Fix this by removing CHN_F_SLEEPING altogether, which is not very useful
in the first place:

  • CHN_BROADCAST() checks cv_waiters already, so there is no need to check CHN_F_SLEEPING as well.
  • We can check whether cv_waiters is 0 in pcm_killchans(), instead of whether CHN_F_SLEEPING is not set.

Reported by: dougm, pho (stress2)
Sponsored by: The FreeBSD Foundation
MFC after: 2 days
Reviewed by: dev_submerge.ch, markj
Differential Revision: https://reviews.freebsd.org/D47559

(cherry picked from commit 5317480967bfc8bf678e4da3fce81bcb3f5b7836)

Details

Provenance
christosAuthored on Tue, Nov 26, 2:48 PM
Reviewer
dev_submerge.ch
Differential Revision
D47559: sound: Remove CHN_F_SLEEPING
Parents
rG3397443e50d2: sound: Remove PCM_DETACHING(), SD_F_DETACHING and SD_F_DYING
Branches
Unknown
Tags
Unknown