]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/file_table.c
saner FASYNC handling on file close
[linux-2.6-omap-h63xx.git] / fs / file_table.c
index f45a4493f9e71b5afe52640f453a33bce0603c70..5ad0eca6eea27b1ee33fcd8415c05edfeac97d82 100644 (file)
@@ -161,7 +161,7 @@ EXPORT_SYMBOL(get_empty_filp);
  * code should be moved into this function.
  */
 struct file *alloc_file(struct vfsmount *mnt, struct dentry *dentry,
-               mode_t mode, const struct file_operations *fop)
+               fmode_t mode, const struct file_operations *fop)
 {
        struct file *file;
        struct path;
@@ -193,7 +193,7 @@ EXPORT_SYMBOL(alloc_file);
  * of this should be moving to alloc_file().
  */
 int init_file(struct file *file, struct vfsmount *mnt, struct dentry *dentry,
-          mode_t mode, const struct file_operations *fop)
+          fmode_t mode, const struct file_operations *fop)
 {
        int error = 0;
        file->f_path.dentry = dentry;
@@ -269,6 +269,10 @@ void __fput(struct file *file)
        eventpoll_release(file);
        locks_remove_flock(file);
 
+       if (unlikely(file->f_flags & FASYNC)) {
+               if (file->f_op && file->f_op->fasync)
+                       file->f_op->fasync(-1, file, 0);
+       }
        if (file->f_op && file->f_op->release)
                file->f_op->release(inode, file);
        security_file_free(file);