[ALSA] Handle file operations during snd_card disconnects using static file->f_op
authorKarsten Wiese <fzu@wemgehoertderstaat.de>
Fri, 6 Oct 2006 14:08:27 +0000 (16:08 +0200)
committerJaroslav Kysela <perex@suse.cz>
Fri, 6 Oct 2006 18:23:04 +0000 (20:23 +0200)
commita9edfc60227a1dc5c741666ff252a6055b73b184
tree15993e126624ec9e05f33f957ee4f69bd4787220
parent4130d59b1ac6e32c130bd59dbce5eb30fede0197
[ALSA] Handle file operations during snd_card disconnects using static file->f_op

Alsa used to kmalloc one file->f_op per file per disconnecting snd_card.
This led to oopses sometimes when file->f_op was freed before __fput()
finished.
Patch adds a virtual device for disconnect: VDD.
VDD consists of:
LIST_HEAD(shutdown_files)
    protected by DEFINE_SPINLOCK(shutdown_mutex)
static struct file_operations snd_shutdown_f_ops
    and functions assigned to it
Additions to struct snd_monitor_file
    to specify if instance is hidden by VDD or not.
A VDD's instance is
created in snd_card_disconnect() under the card->files_lock.
cleaned up in snd_card_file_remove() under the card->files_lock.

Signed-off-by: Karsten Wiese <fzu@wemgehoertderstaat.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
include/sound/core.h
sound/core/init.c