[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.1.10.0906031153471.18001@makko.or.mcafeemobile.com>
Date: Wed, 3 Jun 2009 12:00:22 -0700 (PDT)
From: Davide Libenzi <davidel@...ilserver.org>
To: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
cc: Andrew Morton <akpm@...ux-foundation.org>,
Gregory Haskins <ghaskins@...ell.com>
Subject: [patch] epoll - send POLLHUP on ->release
The following patch allows waiters to be notified about the eventfd file*
going away, and give them a change to unregister from the wait queue.
This is turn allows eventfd users to use the eventfd file* w/out
holding a live reference to it.
After the eventfd user callbacks returns, any usage of the eventfd file*
should be dropped. The eventfd user callback can acquire sleepy locks
since it is invoked lockless.
Signed-off-by: Davide Libenzi <davidel@...ilserver.org>
- Davide
---
fs/eventfd.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
Index: linux-2.6.mod/fs/eventfd.c
===================================================================
--- linux-2.6.mod.orig/fs/eventfd.c 2009-05-27 12:10:03.000000000 -0700
+++ linux-2.6.mod/fs/eventfd.c 2009-05-27 12:16:57.000000000 -0700
@@ -59,7 +59,15 @@ int eventfd_signal(struct file *file, in
static int eventfd_release(struct inode *inode, struct file *file)
{
- kfree(file->private_data);
+ struct eventfd_ctx *ctx = file->private_data;
+
+ /*
+ * No need to hold the lock here, since we are on the file cleanup
+ * path and the ones still attached to the wait queue will be
+ * serialized by wake_up_locked_poll().
+ */
+ wake_up_locked_poll(&ctx->wqh, POLLHUP);
+ kfree(ctx);
return 0;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists