diff options
-rw-r--r-- | fs/eventfd.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/eventfd.c b/fs/eventfd.c index 4b0a226024fa..8d0c0df01854 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c | |||
@@ -118,18 +118,18 @@ static unsigned int eventfd_poll(struct file *file, poll_table *wait) | |||
118 | { | 118 | { |
119 | struct eventfd_ctx *ctx = file->private_data; | 119 | struct eventfd_ctx *ctx = file->private_data; |
120 | unsigned int events = 0; | 120 | unsigned int events = 0; |
121 | unsigned long flags; | 121 | u64 count; |
122 | 122 | ||
123 | poll_wait(file, &ctx->wqh, wait); | 123 | poll_wait(file, &ctx->wqh, wait); |
124 | smp_rmb(); | ||
125 | count = ctx->count; | ||
124 | 126 | ||
125 | spin_lock_irqsave(&ctx->wqh.lock, flags); | 127 | if (count > 0) |
126 | if (ctx->count > 0) | ||
127 | events |= POLLIN; | 128 | events |= POLLIN; |
128 | if (ctx->count == ULLONG_MAX) | 129 | if (count == ULLONG_MAX) |
129 | events |= POLLERR; | 130 | events |= POLLERR; |
130 | if (ULLONG_MAX - 1 > ctx->count) | 131 | if (ULLONG_MAX - 1 > count) |
131 | events |= POLLOUT; | 132 | events |= POLLOUT; |
132 | spin_unlock_irqrestore(&ctx->wqh.lock, flags); | ||
133 | 133 | ||
134 | return events; | 134 | return events; |
135 | } | 135 | } |