Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755299AbZGBQnd (ORCPT ); Thu, 2 Jul 2009 12:43:33 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752567AbZGBQnY (ORCPT ); Thu, 2 Jul 2009 12:43:24 -0400 Received: from x35.xmailserver.org ([64.71.152.41]:39412 "EHLO x35.xmailserver.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751993AbZGBQnY (ORCPT ); Thu, 2 Jul 2009 12:43:24 -0400 X-AuthUser: davidel@xmailserver.org Date: Thu, 2 Jul 2009 09:43:23 -0700 (PDT) From: Davide Libenzi X-X-Sender: davide@makko.or.mcafeemobile.com To: Gregory Haskins cc: kvm@vger.kernel.org, Linux Kernel Mailing List , mst@redhat.com, avi@redhat.com Subject: Re: [KVM PATCH v9 2/5] eventfd: use locked POLLHUP In-Reply-To: <20090702153806.20186.76377.stgit@dev.haskins.net> Message-ID: References: <20090702153454.20186.99191.stgit@dev.haskins.net> <20090702153806.20186.76377.stgit@dev.haskins.net> User-Agent: Alpine 1.10 (DEB 962 2008-03-14) X-GPG-FINGRPRINT: CFAE 5BEE FD36 F65E E640 56FE 0974 BF23 270F 474E X-GPG-PUBLIC_KEY: http://www.xmailserver.org/davidel.asc MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1565 Lines: 47 On Thu, 2 Jul 2009, Gregory Haskins wrote: > eventfd currently emits a POLLHUP wakeup on f_ops->release() to generate a > "release" callback. This lets eventfd clients know if the eventfd is about > to go away and is very useful particularly for in-kernel clients. However, > as it stands today it is not possible to use this feature of eventfd in a > race-free way. This patch changes the POLLHUP code to use the locked variant > to rectify this problem. > > Signed-off-by: Gregory Haskins > CC: Davide Libenzi > --- > > fs/eventfd.c | 7 +------ > 1 files changed, 1 insertions(+), 6 deletions(-) > > diff --git a/fs/eventfd.c b/fs/eventfd.c > index d9849a1..31d12de 100644 > --- a/fs/eventfd.c > +++ b/fs/eventfd.c > @@ -105,12 +105,7 @@ static int eventfd_release(struct inode *inode, struct file *file) > { > 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); > + wake_up_poll(&ctx->wqh, POLLHUP); > eventfd_ctx_put(ctx); > return 0; > } ACK. BTW, mainline already has the correct wake_up_poll(). - Davide -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/