mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 04:06:22 +00:00
[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>
This commit is contained in:
parent
70674f95c0
commit
e4a1f129f9
1 changed files with 6 additions and 4 deletions
10
fs/select.c
10
fs/select.c
|
@ -231,17 +231,18 @@ int do_select(int n, fd_set_bits *fds, s64 *timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < __NFDBITS; ++j, ++i, bit <<= 1) {
|
for (j = 0; j < __NFDBITS; ++j, ++i, bit <<= 1) {
|
||||||
|
int fput_needed;
|
||||||
if (i >= n)
|
if (i >= n)
|
||||||
break;
|
break;
|
||||||
if (!(bit & all_bits))
|
if (!(bit & all_bits))
|
||||||
continue;
|
continue;
|
||||||
file = fget(i);
|
file = fget_light(i, &fput_needed);
|
||||||
if (file) {
|
if (file) {
|
||||||
f_op = file->f_op;
|
f_op = file->f_op;
|
||||||
mask = DEFAULT_POLLMASK;
|
mask = DEFAULT_POLLMASK;
|
||||||
if (f_op && f_op->poll)
|
if (f_op && f_op->poll)
|
||||||
mask = (*f_op->poll)(file, retval ? NULL : wait);
|
mask = (*f_op->poll)(file, retval ? NULL : wait);
|
||||||
fput(file);
|
fput_light(file, fput_needed);
|
||||||
if ((mask & POLLIN_SET) && (in & bit)) {
|
if ((mask & POLLIN_SET) && (in & bit)) {
|
||||||
res_in |= bit;
|
res_in |= bit;
|
||||||
retval++;
|
retval++;
|
||||||
|
@ -557,14 +558,15 @@ static void do_pollfd(unsigned int num, struct pollfd * fdpage,
|
||||||
fdp = fdpage+i;
|
fdp = fdpage+i;
|
||||||
fd = fdp->fd;
|
fd = fdp->fd;
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
struct file * file = fget(fd);
|
int fput_needed;
|
||||||
|
struct file * file = fget_light(fd, &fput_needed);
|
||||||
mask = POLLNVAL;
|
mask = POLLNVAL;
|
||||||
if (file != NULL) {
|
if (file != NULL) {
|
||||||
mask = DEFAULT_POLLMASK;
|
mask = DEFAULT_POLLMASK;
|
||||||
if (file->f_op && file->f_op->poll)
|
if (file->f_op && file->f_op->poll)
|
||||||
mask = file->f_op->poll(file, *pwait);
|
mask = file->f_op->poll(file, *pwait);
|
||||||
mask &= fdp->events | POLLERR | POLLHUP;
|
mask &= fdp->events | POLLERR | POLLHUP;
|
||||||
fput(file);
|
fput_light(file, fput_needed);
|
||||||
}
|
}
|
||||||
if (mask) {
|
if (mask) {
|
||||||
*pwait = NULL;
|
*pwait = NULL;
|
||||||
|
|
Loading…
Reference in a new issue