From 0d1b88ecc0197fa6dce89f7020c70efb85324499 Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Wed, 5 May 2010 12:53:12 +0200 Subject: [PATCH] --- yaml --- r: 195445 b: refs/heads/master c: 8120a8aadb2059e29982561658bc6675126f8105 h: refs/heads/master i: 195443: f15d5ebdd7e040414f7166404605496b2775a372 v: v3 --- [refs] | 2 +- trunk/fs/timerfd.c | 25 ++++--------------------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/[refs] b/[refs] index 257c36214693..a7af2c0d7ee4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 22c43c81a51e05f61e90445ceb59d486c12fd921 +refs/heads/master: 8120a8aadb2059e29982561658bc6675126f8105 diff --git a/trunk/fs/timerfd.c b/trunk/fs/timerfd.c index 98158de91d24..b86ab8eff79a 100644 --- a/trunk/fs/timerfd.c +++ b/trunk/fs/timerfd.c @@ -110,31 +110,14 @@ static ssize_t timerfd_read(struct file *file, char __user *buf, size_t count, struct timerfd_ctx *ctx = file->private_data; ssize_t res; u64 ticks = 0; - DECLARE_WAITQUEUE(wait, current); if (count < sizeof(ticks)) return -EINVAL; spin_lock_irq(&ctx->wqh.lock); - res = -EAGAIN; - if (!ctx->ticks && !(file->f_flags & O_NONBLOCK)) { - __add_wait_queue(&ctx->wqh, &wait); - for (res = 0;;) { - set_current_state(TASK_INTERRUPTIBLE); - if (ctx->ticks) { - res = 0; - break; - } - if (signal_pending(current)) { - res = -ERESTARTSYS; - break; - } - spin_unlock_irq(&ctx->wqh.lock); - schedule(); - spin_lock_irq(&ctx->wqh.lock); - } - __remove_wait_queue(&ctx->wqh, &wait); - __set_current_state(TASK_RUNNING); - } + if (file->f_flags & O_NONBLOCK) + res = -EAGAIN; + else + res = wait_event_interruptible_locked_irq(ctx->wqh, ctx->ticks); if (ctx->ticks) { ticks = ctx->ticks; if (ctx->expired && ctx->tintv.tv64) {