diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1999-07-05 23:09:37 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1999-07-05 23:09:37 +0000 |
commit | aba344fdfed81b2c03d6114c54cfd73a486aa10b (patch) | |
tree | d032d8430bf1234c3ecc6f6330d6de6e887e5963 /fs/select.c | |
parent | 40c138bfc6d37dbff5339f84575db1e3cec6e34e (diff) |
Merge with Linux 2.3.9.
Diffstat (limited to 'fs/select.c')
-rw-r--r-- | fs/select.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/fs/select.c b/fs/select.c index e47e3b0b4..4cb1a6d55 100644 --- a/fs/select.c +++ b/fs/select.c @@ -64,9 +64,9 @@ void __pollwait(struct file * filp, wait_queue_head_t * wait_address, poll_table if (p->nr < __MAX_POLL_TABLE_ENTRIES) { struct poll_table_entry * entry; ok_table: - entry = p->entry + p->nr; - entry->filp = filp; - filp->f_count++; + entry = p->entry + p->nr; + entry->filp = filp; + atomic_inc(&filp->f_count); entry->wait_address = wait_address; init_waitqueue_entry(&entry->wait, current); add_wait_queue(wait_address,&entry->wait); @@ -181,17 +181,13 @@ int do_select(int n, fd_set_bits *fds, long *timeout) off = i / __NFDBITS; if (!(bit & BITS(fds, off))) continue; - /* - * The poll_wait routine will increment f_count if - * the file is added to the wait table, so we don't - * need to increment it now. - */ - file = fcheck(i); + file = fget(i); mask = POLLNVAL; if (file) { mask = DEFAULT_POLLMASK; if (file->f_op && file->f_op->poll) mask = file->f_op->poll(file, wait); + fput(file); } if ((mask & POLLIN_SET) && ISSET(bit, __IN(fds,off))) { SET(bit, __RES_IN(fds,off)); @@ -347,14 +343,14 @@ static int do_poll(unsigned int nfds, struct pollfd *fds, poll_table *wait, mask = 0; fd = fdpnt->fd; if (fd >= 0) { - /* poll_wait increments f_count if needed */ - struct file * file = fcheck(fd); + struct file * file = fget(fd); mask = POLLNVAL; if (file != NULL) { mask = DEFAULT_POLLMASK; if (file->f_op && file->f_op->poll) mask = file->f_op->poll(file, wait); mask &= fdpnt->events | POLLERR | POLLHUP; + fput(file); } if (mask) { wait = NULL; |