diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-13 01:34:18 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-13 01:34:18 -0500 |
commit | 9bc9ccd7db1c9f043f75380b5a5b94912046a60e (patch) | |
tree | dd0a1b3396ae9414f668b0110cc39d11268ad3ed /sound | |
parent | f0230294271f511b41797305b685365a9e569a09 (diff) | |
parent | bdd3536618443809d18868563eeafa63b9d29603 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs updates from Al Viro:
"All kinds of stuff this time around; some more notable parts:
- RCU'd vfsmounts handling
- new primitives for coredump handling
- files_lock is gone
- Bruce's delegations handling series
- exportfs fixes
plus misc stuff all over the place"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (101 commits)
ecryptfs: ->f_op is never NULL
locks: break delegations on any attribute modification
locks: break delegations on link
locks: break delegations on rename
locks: helper functions for delegation breaking
locks: break delegations on unlink
namei: minor vfs_unlink cleanup
locks: implement delegations
locks: introduce new FL_DELEG lock flag
vfs: take i_mutex on renamed file
vfs: rename I_MUTEX_QUOTA now that it's not used for quotas
vfs: don't use PARENT/CHILD lock classes for non-directories
vfs: pull ext4's double-i_mutex-locking into common code
exportfs: fix quadratic behavior in filehandle lookup
exportfs: better variable name
exportfs: move most of reconnect_path to helper function
exportfs: eliminate unused "noprogress" counter
exportfs: stop retrying once we race with rename/remove
exportfs: clear DISCONNECTED on all parents sooner
exportfs: more detailed comment for path_reconnect
...
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/sound.c | 22 | ||||
-rw-r--r-- | sound/sound_core.c | 17 |
2 files changed, 9 insertions, 30 deletions
diff --git a/sound/core/sound.c b/sound/core/sound.c index f002bd911dae..437c25ea6403 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c | |||
@@ -153,7 +153,7 @@ static int snd_open(struct inode *inode, struct file *file) | |||
153 | { | 153 | { |
154 | unsigned int minor = iminor(inode); | 154 | unsigned int minor = iminor(inode); |
155 | struct snd_minor *mptr = NULL; | 155 | struct snd_minor *mptr = NULL; |
156 | const struct file_operations *old_fops; | 156 | const struct file_operations *new_fops; |
157 | int err = 0; | 157 | int err = 0; |
158 | 158 | ||
159 | if (minor >= ARRAY_SIZE(snd_minors)) | 159 | if (minor >= ARRAY_SIZE(snd_minors)) |
@@ -167,24 +167,14 @@ static int snd_open(struct inode *inode, struct file *file) | |||
167 | return -ENODEV; | 167 | return -ENODEV; |
168 | } | 168 | } |
169 | } | 169 | } |
170 | old_fops = file->f_op; | 170 | new_fops = fops_get(mptr->f_ops); |
171 | file->f_op = fops_get(mptr->f_ops); | ||
172 | if (file->f_op == NULL) { | ||
173 | file->f_op = old_fops; | ||
174 | err = -ENODEV; | ||
175 | } | ||
176 | mutex_unlock(&sound_mutex); | 171 | mutex_unlock(&sound_mutex); |
177 | if (err < 0) | 172 | if (!new_fops) |
178 | return err; | 173 | return -ENODEV; |
174 | replace_fops(file, new_fops); | ||
179 | 175 | ||
180 | if (file->f_op->open) { | 176 | if (file->f_op->open) |
181 | err = file->f_op->open(inode, file); | 177 | err = file->f_op->open(inode, file); |
182 | if (err) { | ||
183 | fops_put(file->f_op); | ||
184 | file->f_op = fops_get(old_fops); | ||
185 | } | ||
186 | } | ||
187 | fops_put(old_fops); | ||
188 | return err; | 178 | return err; |
189 | } | 179 | } |
190 | 180 | ||
diff --git a/sound/sound_core.c b/sound/sound_core.c index 45759f4cca75..11e953a1fa45 100644 --- a/sound/sound_core.c +++ b/sound/sound_core.c | |||
@@ -626,31 +626,20 @@ static int soundcore_open(struct inode *inode, struct file *file) | |||
626 | if (s) | 626 | if (s) |
627 | new_fops = fops_get(s->unit_fops); | 627 | new_fops = fops_get(s->unit_fops); |
628 | } | 628 | } |
629 | spin_unlock(&sound_loader_lock); | ||
629 | if (new_fops) { | 630 | if (new_fops) { |
630 | /* | 631 | /* |
631 | * We rely upon the fact that we can't be unloaded while the | 632 | * We rely upon the fact that we can't be unloaded while the |
632 | * subdriver is there, so if ->open() is successful we can | 633 | * subdriver is there. |
633 | * safely drop the reference counter and if it is not we can | ||
634 | * revert to old ->f_op. Ugly, indeed, but that's the cost of | ||
635 | * switching ->f_op in the first place. | ||
636 | */ | 634 | */ |
637 | int err = 0; | 635 | int err = 0; |
638 | const struct file_operations *old_fops = file->f_op; | 636 | replace_fops(file, new_fops); |
639 | file->f_op = new_fops; | ||
640 | spin_unlock(&sound_loader_lock); | ||
641 | 637 | ||
642 | if (file->f_op->open) | 638 | if (file->f_op->open) |
643 | err = file->f_op->open(inode,file); | 639 | err = file->f_op->open(inode,file); |
644 | 640 | ||
645 | if (err) { | ||
646 | fops_put(file->f_op); | ||
647 | file->f_op = fops_get(old_fops); | ||
648 | } | ||
649 | |||
650 | fops_put(old_fops); | ||
651 | return err; | 641 | return err; |
652 | } | 642 | } |
653 | spin_unlock(&sound_loader_lock); | ||
654 | return -ENODEV; | 643 | return -ENODEV; |
655 | } | 644 | } |
656 | 645 | ||