X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=fs%2Feventfd.c;h=8d0c0df018549b86b9759225c2aa2ef88a5728dc;hb=158d3b2ad18ca4570c9929b9b31d298d86fa2c02;hp=4b0a226024fa51801b0cd718fcfae79ef828e8e4;hpb=4ba24fef3eb3b142197135223b90ced2f319cd53;p=linux-2.6-block.git 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) { struct eventfd_ctx *ctx = file->private_data; unsigned int events = 0; - unsigned long flags; + u64 count; poll_wait(file, &ctx->wqh, wait); + smp_rmb(); + count = ctx->count; - spin_lock_irqsave(&ctx->wqh.lock, flags); - if (ctx->count > 0) + if (count > 0) events |= POLLIN; - if (ctx->count == ULLONG_MAX) + if (count == ULLONG_MAX) events |= POLLERR; - if (ULLONG_MAX - 1 > ctx->count) + if (ULLONG_MAX - 1 > count) events |= POLLOUT; - spin_unlock_irqrestore(&ctx->wqh.lock, flags); return events; }