diff options
author | Al Viro <viro@ZenIV.linux.org.uk> | 2008-10-31 19:28:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-11-01 12:49:46 -0400 |
commit | 233e70f4228e78eb2f80dc6650f65d3ae3dbf17c (patch) | |
tree | 4e18fbe1851e6d2161b7f18265cb21f8a61e3ce7 /drivers/char | |
parent | 3318a386e4ca68c76e0294363d29bdc46fcad670 (diff) |
saner FASYNC handling on file close
As it is, all instances of ->release() for files that have ->fasync()
need to remember to evict file from fasync lists; forgetting that
creates a hole and we actually have a bunch that *does* forget.
So let's keep our lives simple - let __fput() check FASYNC in
file->f_flags and call ->fasync() there if it's been set. And lose that
crap in ->release() instances - leaving it there is still valid, but we
don't have to bother anymore.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/hpet.c | 3 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_devintf.c | 2 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_watchdog.c | 1 | ||||
-rw-r--r-- | drivers/char/random.c | 7 | ||||
-rw-r--r-- | drivers/char/rtc.c | 2 | ||||
-rw-r--r-- | drivers/char/sonypi.c | 1 |
6 files changed, 0 insertions, 16 deletions
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 408f5f92cb4e..53fdc7ff3870 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -427,9 +427,6 @@ static int hpet_release(struct inode *inode, struct file *file) | |||
427 | if (irq) | 427 | if (irq) |
428 | free_irq(irq, devp); | 428 | free_irq(irq, devp); |
429 | 429 | ||
430 | if (file->f_flags & FASYNC) | ||
431 | hpet_fasync(-1, file, 0); | ||
432 | |||
433 | file->private_data = NULL; | 430 | file->private_data = NULL; |
434 | return 0; | 431 | return 0; |
435 | } | 432 | } |
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c index 1d7b429f7ffa..41fc11dc921c 100644 --- a/drivers/char/ipmi/ipmi_devintf.c +++ b/drivers/char/ipmi/ipmi_devintf.c | |||
@@ -162,8 +162,6 @@ static int ipmi_release(struct inode *inode, struct file *file) | |||
162 | if (rv) | 162 | if (rv) |
163 | return rv; | 163 | return rv; |
164 | 164 | ||
165 | ipmi_fasync (-1, file, 0); | ||
166 | |||
167 | /* FIXME - free the messages in the list. */ | 165 | /* FIXME - free the messages in the list. */ |
168 | kfree(priv); | 166 | kfree(priv); |
169 | 167 | ||
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 235fab0bdf79..a4d57e31f713 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c | |||
@@ -870,7 +870,6 @@ static int ipmi_close(struct inode *ino, struct file *filep) | |||
870 | clear_bit(0, &ipmi_wdog_open); | 870 | clear_bit(0, &ipmi_wdog_open); |
871 | } | 871 | } |
872 | 872 | ||
873 | ipmi_fasync(-1, filep, 0); | ||
874 | expect_close = 0; | 873 | expect_close = 0; |
875 | 874 | ||
876 | return 0; | 875 | return 0; |
diff --git a/drivers/char/random.c b/drivers/char/random.c index 705a839f1796..675076f5fca8 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -1139,18 +1139,12 @@ static int random_fasync(int fd, struct file *filp, int on) | |||
1139 | return fasync_helper(fd, filp, on, &fasync); | 1139 | return fasync_helper(fd, filp, on, &fasync); |
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | static int random_release(struct inode *inode, struct file *filp) | ||
1143 | { | ||
1144 | return fasync_helper(-1, filp, 0, &fasync); | ||
1145 | } | ||
1146 | |||
1147 | const struct file_operations random_fops = { | 1142 | const struct file_operations random_fops = { |
1148 | .read = random_read, | 1143 | .read = random_read, |
1149 | .write = random_write, | 1144 | .write = random_write, |
1150 | .poll = random_poll, | 1145 | .poll = random_poll, |
1151 | .unlocked_ioctl = random_ioctl, | 1146 | .unlocked_ioctl = random_ioctl, |
1152 | .fasync = random_fasync, | 1147 | .fasync = random_fasync, |
1153 | .release = random_release, | ||
1154 | }; | 1148 | }; |
1155 | 1149 | ||
1156 | const struct file_operations urandom_fops = { | 1150 | const struct file_operations urandom_fops = { |
@@ -1158,7 +1152,6 @@ const struct file_operations urandom_fops = { | |||
1158 | .write = random_write, | 1152 | .write = random_write, |
1159 | .unlocked_ioctl = random_ioctl, | 1153 | .unlocked_ioctl = random_ioctl, |
1160 | .fasync = random_fasync, | 1154 | .fasync = random_fasync, |
1161 | .release = random_release, | ||
1162 | }; | 1155 | }; |
1163 | 1156 | ||
1164 | /*************************************************************** | 1157 | /*************************************************************** |
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index 32dc89720d58..20d6efb6324e 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
@@ -788,8 +788,6 @@ static int rtc_release(struct inode *inode, struct file *file) | |||
788 | } | 788 | } |
789 | spin_unlock_irq(&rtc_lock); | 789 | spin_unlock_irq(&rtc_lock); |
790 | 790 | ||
791 | if (file->f_flags & FASYNC) | ||
792 | rtc_fasync(-1, file, 0); | ||
793 | no_irq: | 791 | no_irq: |
794 | #endif | 792 | #endif |
795 | 793 | ||
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index 85e0eb76eeab..2457b07dabd6 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -898,7 +898,6 @@ static int sonypi_misc_fasync(int fd, struct file *filp, int on) | |||
898 | 898 | ||
899 | static int sonypi_misc_release(struct inode *inode, struct file *file) | 899 | static int sonypi_misc_release(struct inode *inode, struct file *file) |
900 | { | 900 | { |
901 | sonypi_misc_fasync(-1, file, 0); | ||
902 | mutex_lock(&sonypi_device.lock); | 901 | mutex_lock(&sonypi_device.lock); |
903 | sonypi_device.open_count--; | 902 | sonypi_device.open_count--; |
904 | mutex_unlock(&sonypi_device.lock); | 903 | mutex_unlock(&sonypi_device.lock); |