From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752333AbZHCGxa (ORCPT ); Mon, 3 Aug 2009 02:53:30 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752040AbZHCGx3 (ORCPT ); Mon, 3 Aug 2009 02:53:29 -0400 Received: from cantor.suse.de ([195.135.220.2]:58711 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752026AbZHCGx3 (ORCPT ); Mon, 3 Aug 2009 02:53:29 -0400 Date: Mon, 03 Aug 2009 08:53:29 +0200 Message-ID: From: Takashi Iwai To: Lubomir Rintel Cc: linux-kernel@vger.kernel.org, Jaroslav Kysela , Lennart Poettering , stable@kernel.org, alsa-devel@alsa-project.org Subject: Re: [PATCH] Tell user that stream to be rewound is suspended In-Reply-To: <1249229684-8292-1-git-send-email-lkundrak@v3.sk> References: <1249229684-8292-1-git-send-email-lkundrak@v3.sk> User-Agent: Wanderlust/2.12.0 (Your Wildest Dreams) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 Emacs/22.3 (x86_64-suse-linux-gnu) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Sun, 2 Aug 2009 18:14:44 +0200, Lubomir Rintel wrote: > > Return STRPIPE instead of EBADF when userspace attempts to rewind > of forward a stream that was suspended in meanwhile, so that it > can be recovered by snd_pcm_recover(). > > This was causing Pulseaudio to unload the ALSA sink module under a race > condition when it attempted to rewind the stream right after resume from > suspend, before writing to the stream which would cause it to revive the > stream otherwise. Tested to work with Pulseaudio patched to attempt to > snd_pcm_recover() upon receiving an error from snd_pcm_rewind(). > > Signed-off-by: Lubomir Rintel The change looks fine, but I think this isn't for stable kernel since this is actually an ABI extension. For testing, I'm going to apply this to sound-unstable tree for the time being. I'll merge to the main sound tree soon later, though. thanks, Takashi > --- > sound/core/pcm_native.c | 12 ++++++++++++ > 1 files changed, 12 insertions(+), 0 deletions(-) > > diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c > index ac2150e..d89c816 100644 > --- a/sound/core/pcm_native.c > +++ b/sound/core/pcm_native.c > @@ -2208,6 +2208,9 @@ static snd_pcm_sframes_t snd_pcm_playback_rewind(struct snd_pcm_substream *subst > case SNDRV_PCM_STATE_XRUN: > ret = -EPIPE; > goto __end; > + case SNDRV_PCM_STATE_SUSPENDED: > + ret = -ESTRPIPE; > + goto __end; > default: > ret = -EBADFD; > goto __end; > @@ -2253,6 +2256,9 @@ static snd_pcm_sframes_t snd_pcm_capture_rewind(struct snd_pcm_substream *substr > case SNDRV_PCM_STATE_XRUN: > ret = -EPIPE; > goto __end; > + case SNDRV_PCM_STATE_SUSPENDED: > + ret = -ESTRPIPE; > + goto __end; > default: > ret = -EBADFD; > goto __end; > @@ -2299,6 +2305,9 @@ static snd_pcm_sframes_t snd_pcm_playback_forward(struct snd_pcm_substream *subs > case SNDRV_PCM_STATE_XRUN: > ret = -EPIPE; > goto __end; > + case SNDRV_PCM_STATE_SUSPENDED: > + ret = -ESTRPIPE; > + goto __end; > default: > ret = -EBADFD; > goto __end; > @@ -2345,6 +2354,9 @@ static snd_pcm_sframes_t snd_pcm_capture_forward(struct snd_pcm_substream *subst > case SNDRV_PCM_STATE_XRUN: > ret = -EPIPE; > goto __end; > + case SNDRV_PCM_STATE_SUSPENDED: > + ret = -ESTRPIPE; > + goto __end; > default: > ret = -EBADFD; > goto __end; > -- > 1.6.2.5 >