summaryrefslogtreecommitdiffstats
path: root/fs/fcntl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fcntl.c')
-rw-r--r--fs/fcntl.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/fcntl.c b/fs/fcntl.c
index d737ff082472..c42169459298 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -871,9 +871,9 @@ int fasync_remove_entry(struct file *filp, struct fasync_struct **fapp)
871 if (fa->fa_file != filp) 871 if (fa->fa_file != filp)
872 continue; 872 continue;
873 873
874 spin_lock_irq(&fa->fa_lock); 874 write_lock_irq(&fa->fa_lock);
875 fa->fa_file = NULL; 875 fa->fa_file = NULL;
876 spin_unlock_irq(&fa->fa_lock); 876 write_unlock_irq(&fa->fa_lock);
877 877
878 *fp = fa->fa_next; 878 *fp = fa->fa_next;
879 call_rcu(&fa->fa_rcu, fasync_free_rcu); 879 call_rcu(&fa->fa_rcu, fasync_free_rcu);
@@ -918,13 +918,13 @@ struct fasync_struct *fasync_insert_entry(int fd, struct file *filp, struct fasy
918 if (fa->fa_file != filp) 918 if (fa->fa_file != filp)
919 continue; 919 continue;
920 920
921 spin_lock_irq(&fa->fa_lock); 921 write_lock_irq(&fa->fa_lock);
922 fa->fa_fd = fd; 922 fa->fa_fd = fd;
923 spin_unlock_irq(&fa->fa_lock); 923 write_unlock_irq(&fa->fa_lock);
924 goto out; 924 goto out;
925 } 925 }
926 926
927 spin_lock_init(&new->fa_lock); 927 rwlock_init(&new->fa_lock);
928 new->magic = FASYNC_MAGIC; 928 new->magic = FASYNC_MAGIC;
929 new->fa_file = filp; 929 new->fa_file = filp;
930 new->fa_fd = fd; 930 new->fa_fd = fd;
@@ -987,14 +987,13 @@ static void kill_fasync_rcu(struct fasync_struct *fa, int sig, int band)
987{ 987{
988 while (fa) { 988 while (fa) {
989 struct fown_struct *fown; 989 struct fown_struct *fown;
990 unsigned long flags;
991 990
992 if (fa->magic != FASYNC_MAGIC) { 991 if (fa->magic != FASYNC_MAGIC) {
993 printk(KERN_ERR "kill_fasync: bad magic number in " 992 printk(KERN_ERR "kill_fasync: bad magic number in "
994 "fasync_struct!\n"); 993 "fasync_struct!\n");
995 return; 994 return;
996 } 995 }
997 spin_lock_irqsave(&fa->fa_lock, flags); 996 read_lock(&fa->fa_lock);
998 if (fa->fa_file) { 997 if (fa->fa_file) {
999 fown = &fa->fa_file->f_owner; 998 fown = &fa->fa_file->f_owner;
1000 /* Don't send SIGURG to processes which have not set a 999 /* Don't send SIGURG to processes which have not set a
@@ -1003,7 +1002,7 @@ static void kill_fasync_rcu(struct fasync_struct *fa, int sig, int band)
1003 if (!(sig == SIGURG && fown->signum == 0)) 1002 if (!(sig == SIGURG && fown->signum == 0))
1004 send_sigio(fown, fa->fa_fd, band); 1003 send_sigio(fown, fa->fa_fd, band);
1005 } 1004 }
1006 spin_unlock_irqrestore(&fa->fa_lock, flags); 1005 read_unlock(&fa->fa_lock);
1007 fa = rcu_dereference(fa->fa_next); 1006 fa = rcu_dereference(fa->fa_next);
1008 } 1007 }
1009} 1008}