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/message | |
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/message')
-rw-r--r-- | drivers/message/fusion/mptctl.c | 7 | ||||
-rw-r--r-- | drivers/message/i2o/i2o_config.c | 21 |
2 files changed, 5 insertions, 23 deletions
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index f5233f3d9eff..b89f476cd0a9 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c | |||
@@ -559,12 +559,6 @@ mptctl_fasync(int fd, struct file *filep, int mode) | |||
559 | return ret; | 559 | return ret; |
560 | } | 560 | } |
561 | 561 | ||
562 | static int | ||
563 | mptctl_release(struct inode *inode, struct file *filep) | ||
564 | { | ||
565 | return fasync_helper(-1, filep, 0, &async_queue); | ||
566 | } | ||
567 | |||
568 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 562 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
569 | /* | 563 | /* |
570 | * MPT ioctl handler | 564 | * MPT ioctl handler |
@@ -2706,7 +2700,6 @@ mptctl_hp_targetinfo(unsigned long arg) | |||
2706 | static const struct file_operations mptctl_fops = { | 2700 | static const struct file_operations mptctl_fops = { |
2707 | .owner = THIS_MODULE, | 2701 | .owner = THIS_MODULE, |
2708 | .llseek = no_llseek, | 2702 | .llseek = no_llseek, |
2709 | .release = mptctl_release, | ||
2710 | .fasync = mptctl_fasync, | 2703 | .fasync = mptctl_fasync, |
2711 | .unlocked_ioctl = mptctl_ioctl, | 2704 | .unlocked_ioctl = mptctl_ioctl, |
2712 | #ifdef CONFIG_COMPAT | 2705 | #ifdef CONFIG_COMPAT |
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c index a3fabdbe6ca6..f3384c32b9a1 100644 --- a/drivers/message/i2o/i2o_config.c +++ b/drivers/message/i2o/i2o_config.c | |||
@@ -1097,28 +1097,17 @@ static int cfg_fasync(int fd, struct file *fp, int on) | |||
1097 | static int cfg_release(struct inode *inode, struct file *file) | 1097 | static int cfg_release(struct inode *inode, struct file *file) |
1098 | { | 1098 | { |
1099 | ulong id = (ulong) file->private_data; | 1099 | ulong id = (ulong) file->private_data; |
1100 | struct i2o_cfg_info *p1, *p2; | 1100 | struct i2o_cfg_info *p, **q; |
1101 | unsigned long flags; | 1101 | unsigned long flags; |
1102 | 1102 | ||
1103 | lock_kernel(); | 1103 | lock_kernel(); |
1104 | p1 = p2 = NULL; | ||
1105 | |||
1106 | spin_lock_irqsave(&i2o_config_lock, flags); | 1104 | spin_lock_irqsave(&i2o_config_lock, flags); |
1107 | for (p1 = open_files; p1;) { | 1105 | for (q = &open_files; (p = *q) != NULL; q = &p->next) { |
1108 | if (p1->q_id == id) { | 1106 | if (p->q_id == id) { |
1109 | 1107 | *q = p->next; | |
1110 | if (p1->fasync) | 1108 | kfree(p); |
1111 | cfg_fasync(-1, file, 0); | ||
1112 | if (p2) | ||
1113 | p2->next = p1->next; | ||
1114 | else | ||
1115 | open_files = p1->next; | ||
1116 | |||
1117 | kfree(p1); | ||
1118 | break; | 1109 | break; |
1119 | } | 1110 | } |
1120 | p2 = p1; | ||
1121 | p1 = p1->next; | ||
1122 | } | 1111 | } |
1123 | spin_unlock_irqrestore(&i2o_config_lock, flags); | 1112 | spin_unlock_irqrestore(&i2o_config_lock, flags); |
1124 | unlock_kernel(); | 1113 | unlock_kernel(); |