All of lore.kernel.org
 help / color / mirror / Atom feed
* + epoll-send-pollhup-on-release.patch added to -mm tree
@ 2009-06-03 21:44 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2009-06-03 21:44 UTC (permalink / raw)
  To: mm-commits; +Cc: davidel, ghaskins


The patch titled
     epoll: send POLLHUP on ->release
has been added to the -mm tree.  Its filename is
     epoll-send-pollhup-on-release.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: epoll: send POLLHUP on ->release
From: Davide Libenzi <davidel@xmailserver.org>

Allow 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.

This is a feature, needed by KVM to avoid an awkward workaround when using
eventdf.

Signed-off-by: Davide Libenzi <davidel@xmailserver.org>
Tested-by: Gregory Haskins <ghaskins@novell.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/eventfd.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff -puN fs/eventfd.c~epoll-send-pollhup-on-release fs/eventfd.c
--- a/fs/eventfd.c~epoll-send-pollhup-on-release
+++ a/fs/eventfd.c
@@ -61,7 +61,15 @@ EXPORT_SYMBOL_GPL(eventfd_signal);
 
 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;
 }
 
_

Patches currently in -mm which might be from davidel@xmailserver.org are

epoll-send-pollhup-on-release.patch
linux-next.patch
poll-avoid-extra-wakeups-in-select-poll.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-06-03 21:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-03 21:44 + epoll-send-pollhup-on-release.patch added to -mm tree akpm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.