From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752347AbZHCGzo (ORCPT ); Mon, 3 Aug 2009 02:55:44 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752111AbZHCGzn (ORCPT ); Mon, 3 Aug 2009 02:55:43 -0400 Received: from cantor2.suse.de ([195.135.220.15]:42887 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751629AbZHCGzn (ORCPT ); Mon, 3 Aug 2009 02:55:43 -0400 Date: Mon, 03 Aug 2009 08:55:42 +0200 Message-ID: From: Takashi Iwai To: Denys Vlasenko Cc: linux-kernel@vger.kernel.org Subject: Re: sound: -EPERM on first mplayer invocation In-Reply-To: <200908022336.48898.vda.linux@googlemail.com> References: <200908022336.48898.vda.linux@googlemail.com> 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 23:36:48 +0200, Denys Vlasenko wrote: > > Hi, > > For a long time I observe the following nuisance: > when I run mplayer for the very first time after boot, > I can't adjust the volume. mplayer spews this to stderr: > > alsa-control: error setting left channel, Operation not permitted > > This happens even if I login as root and run mplayer as root. > > I tracked it down to snd_ctl_elem_write in sound/core/control.c > > static int snd_ctl_elem_write(struct snd_card *card, struct snd_ctl_file *file, > struct snd_ctl_elem_value *control) > { > struct snd_kcontrol *kctl; > struct snd_kcontrol_volatile *vd; > unsigned int index_offset; > int result; > > down_read(&card->controls_rwsem); > kctl = snd_ctl_find_id(card, &control->id); > if (kctl == NULL) { > result = -ENOENT; > } else { > index_offset = snd_ctl_get_ioff(kctl, &control->id); > vd = &kctl->vd[index_offset]; > if (!(vd->access & SNDRV_CTL_ELEM_ACCESS_WRITE) || > kctl->put == NULL || > (file && vd->owner && vd->owner != file)) { > printk("EPERM:\n"); > printk("vd->access & SNDRV_CTL_ELEM_ACCESS_WRITE:%x\n", vd->access & SNDRV_CTL_ELEM_ACCESS_WRITE); > printk("kctl->put:%p\n", kctl->put); > printk("file:%p vd->owner:%p\n", file, vd->owner); > result = -EPERM; > } else { > > The above printk triggers and prints: > > EPERM: > vd->access & SNDRV_CTL_ELEM_ACCESS_WRITE:2 > kctl->put:ffffffffa009e8de > file:ffff88007c56a5c0 vd->owner:ffff88007bc34740 > > Thus, vd->owner != file. > > As I said, it only happens on very first run of mplayer, > and it isn't a recent change, I think I saw it at least > for one year with different kernels. > > Takashi, any idea what might be happening here? > How can I help you more with tracking it down? This implies that another process (e.g. a sound daemon like PA) already opened the device and locked this specific control element. If so, this is no bug but the right behavior. Check "fuser /dev/snd/controlC*". Takashi