From: Gregory Haskins <ghaskins@novell.com>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [patch] epoll - send POLLHUP on ->release
Date: Wed, 03 Jun 2009 15:20:26 -0400 [thread overview]
Message-ID: <4A26CCFA.7050105@novell.com> (raw)
In-Reply-To: <alpine.DEB.1.10.0906031153471.18001@makko.or.mcafeemobile.com>
[-- Attachment #1: Type: text/plain, Size: 1491 bytes --]
Davide Libenzi wrote:
> 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@xmailserver.org>
>
Tested-by: Gregory Haskins <ghaskins@novell.com>
>
> - 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;
> }
>
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 266 bytes --]
next prev parent reply other threads:[~2009-06-03 19:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-03 19:00 [patch] epoll - send POLLHUP on ->release Davide Libenzi
2009-06-03 19:20 ` Gregory Haskins [this message]
2009-06-03 19:27 ` Andrew Morton
2009-06-03 19:47 ` Davide Libenzi
2009-06-03 19:53 ` Gregory Haskins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A26CCFA.7050105@novell.com \
--to=ghaskins@novell.com \
--cc=akpm@linux-foundation.org \
--cc=davidel@xmailserver.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox