diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2006-03-28 04:56:34 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-28 12:16:04 -0500 |
commit | e4a1f129f9e43a5e5d28fe6d1b214246a398cdce (patch) | |
tree | 9a8277520d5ef1bf8e86f11d76e6f0244efd9330 /fs | |
parent | 70674f95c0a2ea694d5c39f4e514f538a09be36f (diff) |
[PATCH] use fget_light() in select/poll
Cc: Andi Kleen <ak@muc.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/select.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/select.c b/fs/select.c index d8b4f0722b8d..05cd199a1127 100644 --- a/fs/select.c +++ b/fs/select.c | |||
@@ -231,17 +231,18 @@ int do_select(int n, fd_set_bits *fds, s64 *timeout) | |||
231 | } | 231 | } |
232 | 232 | ||
233 | for (j = 0; j < __NFDBITS; ++j, ++i, bit <<= 1) { | 233 | for (j = 0; j < __NFDBITS; ++j, ++i, bit <<= 1) { |
234 | int fput_needed; | ||
234 | if (i >= n) | 235 | if (i >= n) |
235 | break; | 236 | break; |
236 | if (!(bit & all_bits)) | 237 | if (!(bit & all_bits)) |
237 | continue; | 238 | continue; |
238 | file = fget(i); | 239 | file = fget_light(i, &fput_needed); |
239 | if (file) { | 240 | if (file) { |
240 | f_op = file->f_op; | 241 | f_op = file->f_op; |
241 | mask = DEFAULT_POLLMASK; | 242 | mask = DEFAULT_POLLMASK; |
242 | if (f_op && f_op->poll) | 243 | if (f_op && f_op->poll) |
243 | mask = (*f_op->poll)(file, retval ? NULL : wait); | 244 | mask = (*f_op->poll)(file, retval ? NULL : wait); |
244 | fput(file); | 245 | fput_light(file, fput_needed); |
245 | if ((mask & POLLIN_SET) && (in & bit)) { | 246 | if ((mask & POLLIN_SET) && (in & bit)) { |
246 | res_in |= bit; | 247 | res_in |= bit; |
247 | retval++; | 248 | retval++; |
@@ -557,14 +558,15 @@ static void do_pollfd(unsigned int num, struct pollfd * fdpage, | |||
557 | fdp = fdpage+i; | 558 | fdp = fdpage+i; |
558 | fd = fdp->fd; | 559 | fd = fdp->fd; |
559 | if (fd >= 0) { | 560 | if (fd >= 0) { |
560 | struct file * file = fget(fd); | 561 | int fput_needed; |
562 | struct file * file = fget_light(fd, &fput_needed); | ||
561 | mask = POLLNVAL; | 563 | mask = POLLNVAL; |
562 | if (file != NULL) { | 564 | if (file != NULL) { |
563 | mask = DEFAULT_POLLMASK; | 565 | mask = DEFAULT_POLLMASK; |
564 | if (file->f_op && file->f_op->poll) | 566 | if (file->f_op && file->f_op->poll) |
565 | mask = file->f_op->poll(file, *pwait); | 567 | mask = file->f_op->poll(file, *pwait); |
566 | mask &= fdp->events | POLLERR | POLLHUP; | 568 | mask &= fdp->events | POLLERR | POLLHUP; |
567 | fput(file); | 569 | fput_light(file, fput_needed); |
568 | } | 570 | } |
569 | if (mask) { | 571 | if (mask) { |
570 | *pwait = NULL; | 572 | *pwait = NULL; |