From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Andrew Morton <akpm@osdl.org>
Cc: Linus Torvalds <torvalds@osdl.org>,
Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: [PATCH] dmasound close timeout
Date: Fri, 26 Mar 2004 14:33:41 +1100 [thread overview]
Message-ID: <1080272020.1206.24.camel@gaston> (raw)
Hi !
The dmasound driver occasionally hangs a process on exit,
apparently, there is a possible case where the sound HW stops
draining output samples and the driver waits forever in its
release() callback. It should check for signals(), but it
seems signal_pending() never returns 1 when the process is
beeing killed (implicit release() of files on exit).
This patch adds a safety timeout to the release() function
to make sure we can at least close the driver. I'll try to
find the reason we aren't driving samples later, but it is
better to have a safety just incase the sound clock goes
berserk for some reason.
Ben.
diff -urN linux-2.5/sound/oss/dmasound/dmasound_core.c linuxppc-2.5-benh/sound/oss/dmasound/dmasound_core.c
--- linux-2.5/sound/oss/dmasound/dmasound_core.c 2004-03-01 18:13:38.000000000 +1100
+++ linuxppc-2.5-benh/sound/oss/dmasound/dmasound_core.c 2004-03-25 18:41:02.000000000 +1100
@@ -1004,6 +1004,7 @@
static int sq_fsync(struct file *filp, struct dentry *dentry)
{
int rc = 0;
+ int timeout = 5;
write_sq.syncing |= 1;
sq_play(); /* there may be an incomplete frame waiting */
@@ -1018,6 +1019,12 @@
rc = -EINTR;
break;
}
+ if (!--timeout) {
+ printk(KERN_WARNING "dmasound: Timeout draining output\n");
+ sq_reset_output();
+ rc = -EIO;
+ break;
+ }
}
/* flag no sync regardless of whether we had a DSP_POST or not */
reply other threads:[~2004-03-26 3:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1080272020.1206.24.camel@gaston \
--to=benh@kernel.crashing.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox